02-12-2010 09:27 AM
Hello,
I have 2 threads interfacing with 2 serial ports on Labview ( Lets say Thread1 , is responsible for polling COM1 and Thread2 for polling COM2 ).
By using occurrences, Thread1 executes before Thread2 and context switching is done according to Labview between the threads. Now, I'm looking to do the following :
As soon as a specific block of code is executed in Thread1, I need Labview to force context switching to execute Thread2. I want to do this in order to synchronize the data received from the 2 threads.
1- So, can this be done, or are there other ways for synchronization ?
2- What if I want Labview to run as a real-time process or a higher priority thread on Windows XP in order to emulate the real-time effect on a Windows XP and not get any delays ? ( I already changed the process priority from the Process explorer, but there seems no effect. I also changed the Labview threads priority to real-time)
3- Are there better approached for (1) & (2) ?
Thank you,
Walid F. Abdelfatah
02-12-2010 09:33 AM
Code thread Two to wait on an occurence and in thread One fire the Occurnece.
Ben
02-12-2010 09:42 AM - edited 02-12-2010 09:47 AM
I already used occurrences for Thread1 to execute before Thread2. Does occurrences guarantee that Labview will switch the context to Thread2, as soon as the occurrence is fired ?
-- Walid
02-12-2010 09:46 AM
wfarid wrote:I already used occurrences for Thread1 to execute before Thread2. Does occurrences guarantee that Labview will switch the context to Thread2, as soon as the context is fired ?
-- Walid
NO!
LV depends on the OS to schedule threads. If you are sticking with Non-RT then you would be better off getting thread one to do the work while it has teh CPU.
Ben