[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] A great thing for when you just can't say no to WinBL

From: Robert McGwier
Subject: [Discuss-gnuradio] A great thing for when you just can't say no to WinBLOWS
Date: Sun, 20 Feb 2005 15:25:40 -0000

I have just moved all of my software defined radio code
away from the HORRID ABOMINATION that is Windows threading
to posix threads.


The heart of the matter for real time code is that semaphores,
mutexes, and threads are objects that are visible to all
processes in winBLOWS.  When you release a semaphore in
WinBLOWS,  it goes out and sees if ANY process has that
object open and is waiting for it.  On the other hand
Critical Sections are strictly local and cannot be shared
across processes (and why would you want to?). This is
the one thing that Windows did right for "real timers".
So by judicious use of flags, counters, and critical
sections,  cygwin and now redhat officially have worked
out posix threading for Windows and it has matured enough
for me to use it.  No longer needing ming, I tried it.

WOW.  A sem_wait is OVER ONE HUNDRED TIMES faster than
a WaitForSingleObject in my code.

I quote from "MultiThreaded Programming with Pthreads":

"The major distinction between Win32 mutexes and Win32 critical
sections is that the former can be defined to be cross-
process, while the latter cannot.  All of the Win32
synchronization variables other than critical sections are
kernel objects.  Their handles must be closed before
the kernel strutures are released.  They are much slower
than critical sections by about two orders of magnitude".

It will indeed be nice to have pthread_t and sem_t
objects are our disposal across operating systems.

While their project was done for VC6 or cygwin or
MingW32, it was about a fifteen minute operation to
make it work perfectly for VC7. It will work with
Borland C as well Alberto.

YMMV but give it a try,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]