SDL_SemTryWait.3
资源名称:NETVIDEO.rar [点击查看]
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:2k
源码类别:
流媒体/Mpeg4/MP4
开发平台:
Visual C++
- .TH "SDL_SemTryWait" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference"
- .SH "NAME"
- SDL_SemTryWait- Attempt to lock a semaphore but don&'t suspend the thread&.
- .SH "SYNOPSIS"
- .PP
- fB#include "SDL&.h"
- #include "SDL_thread&.h"
- .sp
- fBint fBSDL_SemTryWaitfPfR(fBSDL_sem *semfR);
- .SH "DESCRIPTION"
- .PP
- fBSDL_SemTryWaitfP is a non-blocking varient of fIfBSDL_SemWaitfPfR&. If the value of the semaphore pointed to by fBsemfR is positive it will atomically decrement the semaphore value and return 0, otherwise it will return fBSDL_MUTEX_TIMEOUTfR instead of suspending the thread&.
- .PP
- After fBSDL_SemTryWaitfP is successful, the semaphore can be released and its count atomically incremented by a successful call to fISDL_SemPostfR&.
- .SH "RETURN VALUE"
- .PP
- Returns fB0fR if the semaphore was successfully locked or either fBSDL_MUTEX_TIMEOUTfR or fB-1fR if the thread would have suspended or there was an error, respectivly&.
- .PP
- If the semaphore was not successfully locked, the semaphore will be unchanged&.
- .SH "EXAMPLES"
- .PP
- .PP
- .nf
- f(CWres = SDL_SemTryWait(my_sem);
- if (res == SDL_MUTEX_TIMEOUT) {
- return TRY_AGAIN;
- }
- if (res == -1) {
- return WAIT_ERROR;
- }
- &.&.&.
- SDL_SemPost(my_sem);fR
- .fi
- .PP
- .SH "SEE ALSO"
- .PP
- fIfBSDL_CreateSemaphorefPfR, fIfBSDL_DestroySemaphorefPfR, fIfBSDL_SemWaitfPfR, fIfBSDL_SemWaitTimeoutfPfR, fIfBSDL_SemPostfPfR, fIfBSDL_SemValuefPfR
- ..." created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00