|
Size: 747
Comment: create page, add content (Wed Mar 10 ver; changeset 4428)
|
Size: 1449
Comment: minor change
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 6: | Line 6: |
| Use this function to atomically (?? automatically ??) increase the semaphore's count (not blocking). | Use this function to *unlock a semaphore and* atomically increase the semaphore's count ,,(not blocking),,. <<Color2(green,See Remarks.)>> |
| Line 16: | Line 18: |
| ||'''sem'''||^a pointer to the SDL_sem structure to be affected^|| | ||'''sem'''||^a pointer to the SDL_sem structure / semaphore to be incremented^|| |
| Line 19: | Line 21: |
| Returns 0 on success, or -1 on failure; call [[SDL_GetError]]() for more information. | Returns 0 on success ^(and increments the semaphore count)^ or a negative error code on failure *(leaving the semaphore unchanged)*; call [[SDL_GetError]]() for more information. |
| Line 22: | Line 24: |
| * | |
| Line 23: | Line 26: |
| You can add your code example here | SDL_SemPost(my_sem); |
| Line 25: | Line 28: |
| * | |
| Line 27: | Line 31: |
| ''You can add useful comments here'' | *<<BR>>[[SDL_SemPost]]() unlocks the semaphore pointed to by '''sem''' and atomically increments the semaphore's value. Threads that were blocking on the semaphore may be scheduled after this call succeeds. [[SDL_SemPost]]() should be called after a semaphore is locked by a successful call to [[SDL_SemWait]](), [[SDL_SemTryWait]]() or [[SDL_SemWaitTimeout]](). <<BR>>* <<Color2(green,Should the (not blocking) addendum from the header description be moved down here and explained more fully?)>> |
| Line 30: | Line 38: |
| .[[SDL_SemTryWait]] * .[[SDL_SemValue]] * .[[SDL_SemWait]] * .[[SDL_SemWaitTimeout]] * |
DRAFT |
SDL_SemPost
Use this function to *unlock a semaphore and* atomically increase the semaphore's count (not blocking).
green
Contents
Syntax
int SDL_SemPost(SDL_sem* sem)
Function Parameters
sem |
a pointer to the SDL_sem structure / semaphore to be incremented |
Return Value
Returns 0 on success (and increments the semaphore count) or a negative error code on failure *(leaving the semaphore unchanged)*; call SDL_GetError() for more information.
Code Examples
*
SDL_SemPost(my_sem);
*
Remarks
*
SDL_SemPost() unlocks the semaphore pointed to by sem and atomically increments the semaphore's value. Threads that were blocking on the semaphore may be scheduled after this call succeeds.
SDL_SemPost() should be called after a semaphore is locked by a successful call to SDL_SemWait(), SDL_SemTryWait() or SDL_SemWaitTimeout().
*
green
