Wiki Page Content

Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2010-06-02 01:27:33
Size: 747
Editor: SheenaSmith
Comment: create page, add content (Wed Mar 10 ver; changeset 4428)
Revision 6 as of 2010-10-18 02:17:07
Size: 1411
Editor: SheenaSmith
Comment: update content - pointers, structs
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'''||^the semaphore to increment^||
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

Syntax

int SDL_SemPost(SDL_sem* sem)

Function Parameters

sem

the semaphore to increment

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


CategoryAPI, CategoryMutex

None: SDL_SemPost (last edited 2013-08-12 05:48:11 by Sam Lantinga)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit