On Mon, Mar 13, 2006 at 03:52:25PM +0100, Martin Dvh wrote:
[..]
The code should be portable. I was missing the native Win32 call for
mutex_trylock, so someone will have to find it, and define
OMNI_MUTEX_TRYLOCK_IMPLEMENTATION in src/lib/omnithread/ot_nt.h,
with appropriate semantic (return value).
I think you can do this with TryEnterCriticalSection
It does fit indeed. It has just been checked in.
Bob, Thomas, please cvs update gnuradio-core AND gr-audio-portaudio at
same time since I changed the logic of omni_mutex::trylock (returns true
if it grabbed the lock), in order to comply with comment in omnithread.h.
You could also use the omni_semaphore class defined in
gnuradio-core/src/lib/omnithread/nt.cc
This latter one uses CreateSemaphore and WaitForSingleObject with some wrapper
code.
(you probably have to change all defines if you change to using omni_semaphore)
The gr-audio-portaudio code is using omni::mutex and omni::cond calls.
Actually, they are not used for mutual exclusion, but simply as a
notification mean (there's more room/there's more data in the ringbuffer).
Good Lu*k Martin for your presentation. We can wait next week to see whether
James Brown sounds even better with gr-audio-portaudio under Windows ;-)