Annotated edit history of
SDL_SemWaitTimeout(3) version 2, including all changes.
View license author blame.
Rev |
Author |
# |
Line |
2 |
perry |
1 |
SDL_!SemWaitTimeout |
|
|
2 |
!!!SDL_!SemWaitTimeout |
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_!SemWaitTimeout- Lock a semaphore, but only wait up to a specified maximum time. |
1 |
perry |
14 |
!!SYNOPSIS |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
__#include |
|
|
18 |
__ |
|
|
19 |
|
|
|
20 |
|
2 |
perry |
21 |
__int SDL_!SemWaitTimeout__(__SDL_sem *sem, Uint32 |
1 |
perry |
22 |
timeout__); |
|
|
23 |
!!DESCRIPTION |
|
|
24 |
|
|
|
25 |
|
2 |
perry |
26 |
__SDL_!SemWaitTimeout()__ is a varient of |
|
|
27 |
''SDL_!SemWait'' with a maximum timeout value. If the |
1 |
perry |
28 |
value of the semaphore pointed to by __sem__ is positive |
|
|
29 |
(greater than zero) it will atomically decrement the |
|
|
30 |
semaphore value and return 0, otherwise it will wait up to |
|
|
31 |
__timeout__ milliseconds trying to lock the semaphore. |
|
|
32 |
This function is to be avoided if possible since on some |
|
|
33 |
platforms it is implemented by polling the semaphore every |
|
|
34 |
millisecond in a busy loop. |
|
|
35 |
|
|
|
36 |
|
2 |
perry |
37 |
After __SDL_!SemWaitTimeout()__ is successful, the |
1 |
perry |
38 |
semaphore can be released and its count atomically |
|
|
39 |
incremented by a successful call to |
2 |
perry |
40 |
''SDL_!SemPost''. |
1 |
perry |
41 |
!!RETURN VALUE |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
Returns __0__ if the semaphore was successfully locked or |
|
|
45 |
either __SDL_MUTEX_TIMEOUT__ or __-1__ if the timeout |
|
|
46 |
period was exceeded or there was an error, |
|
|
47 |
respectivly. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
If the semaphore was not successfully locked, the semaphore |
|
|
51 |
will be unchanged. |
|
|
52 |
!!EXAMPLES |
|
|
53 |
|
|
|
54 |
|
2 |
perry |
55 |
res = SDL_!SemWaitTimeout(my_sem, WAIT_TIMEOUT_MILLISEC); |
1 |
perry |
56 |
if (res == SDL_MUTEX_TIMEOUT) { |
|
|
57 |
return TRY_AGAIN; |
|
|
58 |
} |
|
|
59 |
if (res == -1) { |
|
|
60 |
return WAIT_ERROR; |
|
|
61 |
} |
|
|
62 |
... |
2 |
perry |
63 |
SDL_!SemPost(my_sem); |
1 |
perry |
64 |
!!SEE ALSO |
|
|
65 |
|
|
|
66 |
|
2 |
perry |
67 |
__SDL_!CreateSemaphore__, __SDL_!DestroySemaphore__, |
|
|
68 |
__SDL_!SemWait__, __SDL_!SemTryWait__, |
|
|
69 |
__SDL_!SemPost__, __SDL_!SemValue__ |
1 |
perry |
70 |
---- |
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.