diff src/thread/generic/SDL_syscond.c @ 5112:0846f18eb625

Improved condition variable documentation
author Sam Lantinga <slouken@libsdl.org>
date Thu, 27 Jan 2011 10:40:17 -0800
parents f7b03b6838cb
children b530ef003506
line wrap: on
line diff
--- a/src/thread/generic/SDL_syscond.c	Thu Jan 27 10:07:14 2011 -0800
+++ b/src/thread/generic/SDL_syscond.c	Thu Jan 27 10:40:17 2011 -0800
@@ -145,18 +145,19 @@
 Typical use:
 
 Thread A:
-	SDL_LockMutex(lock);
-	while ( ! condition ) {
-		SDL_CondWait(cond);
-	}
-	SDL_UnlockMutex(lock);
+    SDL_LockMutex(lock);
+    while ( ! condition ) {
+        SDL_CondWait(cond, lock);
+    }
+    SDL_UnlockMutex(lock);
 
 Thread B:
-	SDL_LockMutex(lock);
-	...
-	condition = true;
-	...
-	SDL_UnlockMutex(lock);
+    SDL_LockMutex(lock);
+    ...
+    condition = true;
+    ...
+    SDL_CondSignal(cond);
+    SDL_UnlockMutex(lock);
  */
 int
 SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)