Lines Matching refs:sem
32 struct SignalSemaphore Sem;
41 SDL_sem *sem;
43 sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
45 if ( ! sem ) {
50 D(bug("Creating semaphore %lx...\n",sem));
52 SDL_memset(sem,0,sizeof(*sem));
54 InitSemaphore(&sem->Sem);
56 return(sem);
59 void SDL_DestroySemaphore(SDL_sem *sem)
61 D(bug("Destroying semaphore %lx...\n",sem));
63 if ( sem ) {
65 SDL_free(sem);
69 int SDL_SemTryWait(SDL_sem *sem)
71 if ( ! sem ) {
76 D(bug("TryWait semaphore...%lx\n",sem));
78 ObtainSemaphore(&sem->Sem);
79 // ReleaseSemaphore(&sem->Sem);
84 int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
89 if ( ! sem ) {
94 D(bug("WaitTimeout (%ld) semaphore...%lx\n",timeout,sem));
98 ObtainSemaphore(&sem->Sem);
101 if(!(retval=AttemptSemaphore(&sem->Sem)))
104 retval=AttemptSemaphore(&sem->Sem);
109 // ReleaseSemaphore(&sem->Sem);
116 int SDL_SemWait(SDL_sem *sem)
118 ObtainSemaphore(&sem->Sem);
122 Uint32 SDL_SemValue(SDL_sem *sem)
127 if ( sem ) {
129 value = sem->Sem.ssppc_SS.ss_NestCount;
131 value = sem->Sem.ss_NestCount;
137 int SDL_SemPost(SDL_sem *sem)
139 if ( ! sem ) {
143 D(bug("SemPost semaphore...%lx\n",sem));
145 ReleaseSemaphore(&sem->Sem);