Penguin
Blame: SDL_SemWaitTimeout(3)
EditPageHistoryDiffInfoLikePages
Annotated edit history of SDL_SemWaitTimeout(3) version 2 showing authors affecting page license. View with all changes included.
Rev Author # Line
1 perry 1 SDL_!SemWaitTimeout
2 !!!SDL_!SemWaitTimeout
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 EXAMPLES
8 SEE ALSO
9 ----
10 !!NAME
11
12
13 SDL_!SemWaitTimeout- Lock a semaphore, but only wait up to a specified maximum time.
14 !!SYNOPSIS
15
16
17 __#include
18 __
19
20
21 __int SDL_!SemWaitTimeout__(__SDL_sem *sem, Uint32
22 timeout__);
23 !!DESCRIPTION
24
25
26 __SDL_!SemWaitTimeout()__ is a varient of
27 ''SDL_!SemWait'' with a maximum timeout value. If the
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
37 After __SDL_!SemWaitTimeout()__ is successful, the
38 semaphore can be released and its count atomically
39 incremented by a successful call to
40 ''SDL_!SemPost''.
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
55 res = SDL_!SemWaitTimeout(my_sem, WAIT_TIMEOUT_MILLISEC);
56 if (res == SDL_MUTEX_TIMEOUT) {
57 return TRY_AGAIN;
58 }
59 if (res == -1) {
60 return WAIT_ERROR;
61 }
62 ...
63 SDL_!SemPost(my_sem);
64 !!SEE ALSO
65
66
67 __SDL_!CreateSemaphore__, __SDL_!DestroySemaphore__,
68 __SDL_!SemWait__, __SDL_!SemTryWait__,
69 __SDL_!SemPost__, __SDL_!SemValue__
70 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.