Penguin
Blame: SDL_SemTryWait(3)
EditPageHistoryDiffInfoLikePages
Annotated edit history of SDL_SemTryWait(3) version 2, including all changes. View license author blame.
Rev Author # Line
2 perry 1 SDL_!SemTryWait
2 !!!SDL_!SemTryWait
1 perry 3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 EXAMPLES
8 SEE ALSO
9 ----
10 !!NAME
11
12
2 perry 13 SDL_!SemTryWait- Attempt to lock a semaphore but don't suspend the thread.
1 perry 14 !!SYNOPSIS
15
16
17 __#include
18 __
19
20
2 perry 21 __int SDL_!SemTryWait__(__SDL_sem *sem__);
1 perry 22 !!DESCRIPTION
23
24
2 perry 25 __SDL_!SemTryWait__ is a non-blocking varient of
26 __SDL_!SemWait__. If the value of the semaphore pointed to
1 perry 27 by __sem__ is positive it will atomically decrement the
28 semaphore value and return 0, otherwise it will return
29 __SDL_MUTEX_TIMEOUT__ instead of suspending the
30 thread.
31
32
2 perry 33 After __SDL_!SemTryWait__ is successful, the semaphore can
1 perry 34 be released and its count atomically incremented by a
2 perry 35 successful call to ''SDL_!SemPost''.
1 perry 36 !!RETURN VALUE
37
38
39 Returns __0__ if the semaphore was successfully locked or
40 either __SDL_MUTEX_TIMEOUT__ or __-1__ if the thread
41 would have suspended or there was an error,
42 respectivly.
43
44
45 If the semaphore was not successfully locked, the semaphore
46 will be unchanged.
47 !!EXAMPLES
48
49
2 perry 50 res = SDL_!SemTryWait(my_sem);
1 perry 51 if (res == SDL_MUTEX_TIMEOUT) {
52 return TRY_AGAIN;
53 }
54 if (res == -1) {
55 return WAIT_ERROR;
56 }
57 ...
2 perry 58 SDL_!SemPost(my_sem);
1 perry 59 !!SEE ALSO
60
61
2 perry 62 __SDL_!CreateSemaphore__, __SDL_!DestroySemaphore__,
63 __SDL_!SemWait__, __SDL_!SemWaitTimeout__,
64 __SDL_!SemPost__, __SDL_!SemValue__
1 perry 65 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.