Some clarification on how SDL_cond works

It looks like SDL_cond is what one would call Events in Win32. However,
what I don’t understand is the role of SDL_mutex. What is that mutex for?
Why must it be locked when I call SDL_CondWait()?

Thank you for your help!_________________________________________________________________
Powerful Parental Controls Let your child discover the best the Internet has
to offer.
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSN? Premium right now and get the
first two months FREE*.

It looks like SDL_cond is what one would call Events in Win32.

Wrong.

However,
what I don’t understand is the role of SDL_mutex. What is that mutex
for?
Why must it be locked when I call SDL_CondWait()?

You use the mutex to be sure to be the only thread accessing the data and
the conditional variable to sleep until the data has some property.
Google for conditional variable.

Regards,
BrunoOn Thu, 01 Jun 2006 04:30:06 -0300, Id Kong <spam_receptacle_ at hotmail.com> wrote:

It looks like SDL_cond is what one would call Events in Win32.

Wrong.

Well, sort of. If you were thinking of “Events” like the GUI event
queue, yeah, that’s wrong, but he was probably aiming more for the
"CreateEvent/SetEvent/etc" Win32 APIs…and there IS a relationship there.

Here’s way more information than you probably wanted about how POSIX
condition variables (which is what SDL is mirroring) map to Win32 APIs:

http://www.cs.wustl.edu/~schmidt/win32-cv-1.html

–ryan.