Click to See Complete Forum and Search --> : sometimes ReleaseSemaphore takes long time, why?
kalven
July 31st, 2007, 10:58 PM
Hi, everyone
I has one thread A (producer), and thread B(consumer).
A get the data from a buffer in DSP hardware , and then ReleaseSemaphore.
B wait the semaphore and process the data.
With some complex UI operations, ReleaseSemaphore takes long time occassionaly. why?
MrViggy
August 1st, 2007, 11:28 AM
What OS? What hardware?
Viggy
kalven
August 3rd, 2007, 02:17 AM
i am sorry, i am not take it clearly.
i am doing with a little complex system.
Take it simply:
1, PCI driver get the data from the buffer in DSP hardware, and them buffer the data.
2, Thread A in PC(windows XP SP2 OS) read the data from PCI buffer, and then Release the Semaphore, which is Waited by Thread B
3, Thread B return from WaitForMultiObjects, and process the data.
the problem is sometimes function ReleaseSemaphore takes time longer than it should.
MikeAThon
August 3rd, 2007, 12:02 PM
Define "long time". Remember that Windows is not a real-time OS, and anything less than a few thread time-slices and context-switches is expected. So, assuming a thread time-slice of around 60 milliseconds, anything less than around 200 milliseconds should be expected.
Mike
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.