Interthread Communication

Why doesn’t SDL implement an equivalent of the condition functions?,
i.e.:
pthread_cond_broadcast
pthread_cond_destroy
pthread_cond_init
pthread_cond_signal
pthread_cond_wait
And since it doesn’t what is an alternate method for achieving their
effect?

Stuart–
This signature has been infected by the signature virus.
Please help me spread and copy me to your .signature.

Why doesn’t SDL implement an equivalent of the condition functions?,
i.e.:
pthread_cond_broadcast
pthread_cond_destroy
pthread_cond_init
pthread_cond_signal
pthread_cond_wait
And since it doesn’t what is an alternate method for achieving their
effect?

I think I asked this before and no one had an answer. :slight_smile:

The only way to do something similar is to use semaphores and waste a
bunch of your programming effort reimplementing POSIX threads. :frowning:

Paul Braman
@Paul_BramanOn Sun, 7 Nov 1999, Stuart Anderson wrote:

hi`

Paul Braman wrote:

Why doesn’t SDL implement an equivalent of the condition functions?,

I guess this answer fits perfectly for all OS Projects: cause nobody did
it :wink: I don’t know SDL very well, but having had a look at the SDL
thread part I think it could be easily added as SDL_Thread is a simple
wrapper to using pthreads (on Linux)… Well, of course you had to
implement it for the other platforms, too.

The only way to do something similar is to use semaphores and waste a
bunch of your programming effort reimplementing POSIX threads. :frowning:

If you do that you’d better add it to the library than adding it to your
code.> On Sun, 7 Nov 1999, Stuart Anderson wrote:


Daniel Vogel

666 @ http://grafzahl.de

hi`

Paul Braman wrote:

Why doesn’t SDL implement an equivalent of the condition functions?,

I guess this answer fits perfectly for all OS Projects: cause nobody did
it :wink: I don’t know SDL very well, but having had a look at the SDL
thread part I think it could be easily added as SDL_Thread is a simple
wrapper to using pthreads (on Linux)… Well, of course you had to
implement it for the other platforms, too.

The only way to do something similar is to use semaphores and waste a
bunch of your programming effort reimplementing POSIX threads. :frowning:

If you do that you’d better add it to the library than adding it to your
code.

It’s tricky to do right, but if someone implements condition variables
on top of SDL_mutex, then I’ll be happy to include it.

pthreads are not very portable across even UNIX platforms, much less
other operating systems, so actually using the pthread functions isn’t
an option. Even the current simple use of pthreads is broken on FreeBSD,
where pthread_cancel isn’t implemented. Older versions of Linux have
broken pthread implementations, and require the use of SysV IPC mutexes.

Just my 0.02 dollars worth. :slight_smile:

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software> > On Sun, 7 Nov 1999, Stuart Anderson wrote:

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec