From 9682c8870b8ff5e4ac2e4c70b759f791c6f38c1f Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Mon, 9 Jul 2012 11:27:07 -0700 Subject: Import SDL release-1.2.15 Change-Id: I505c4aea24325cad475f217db5589814b4c75dbf --- distrib/sdl-1.2.15/docs/html/sdlsemtrywait.html | 319 ++++++++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100644 distrib/sdl-1.2.15/docs/html/sdlsemtrywait.html (limited to 'distrib/sdl-1.2.15/docs/html/sdlsemtrywait.html') diff --git a/distrib/sdl-1.2.15/docs/html/sdlsemtrywait.html b/distrib/sdl-1.2.15/docs/html/sdlsemtrywait.html new file mode 100644 index 0000000..86f47a1 --- /dev/null +++ b/distrib/sdl-1.2.15/docs/html/sdlsemtrywait.html @@ -0,0 +1,319 @@ +SDL_SemTryWait
SDL Library Documentation
PrevNext

SDL_SemTryWait

Name

SDL_SemTryWait -- Attempt to lock a semaphore but don't suspend the thread.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_SemTryWait(SDL_sem *sem);

Description

SDL_SemTryWait is a non-blocking varient of +SDL_SemWait. If the value of the semaphore +pointed to by sem is positive it will atomically +decrement the semaphore value and return 0, otherwise it will return +SDL_MUTEX_TIMEDOUT instead of suspending the thread.

After SDL_SemTryWait is successful, the semaphore +can be released and its count atomically incremented by a successful call to +SDL_SemPost.

Return Value

Returns 0 if the semaphore was successfully locked or +either SDL_MUTEX_TIMEDOUT or -1 +if the thread would have suspended or there was an error, respectivly.

If the semaphore was not successfully locked, the semaphore will be unchanged.

Examples

res = SDL_SemTryWait(my_sem);
+
+if (res == SDL_MUTEX_TIMEDOUT) {
+        return TRY_AGAIN;
+}
+if (res == -1) {
+        return WAIT_ERROR;
+}
+
+...
+
+SDL_SemPost(my_sem);

See Also

SDL_CreateSemaphore, +SDL_DestroySemaphore, +SDL_SemWait, +SDL_SemWaitTimeout, +SDL_SemPost, +SDL_SemValue


PrevHomeNext
SDL_SemWaitUpSDL_SemWaitTimeout
\ No newline at end of file -- cgit v1.1