Home | History | Annotate | Download | only in os2

Lines Matching defs:mutex

24 /* Mutex functions using the OS/2 API */
37 /* Create a mutex */
40 SDL_mutex *mutex;
43 /* Allocate mutex memory */
44 mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex));
45 if (mutex)
47 /* Create the mutex, with initial value signaled */
49 &(mutex->hmtxID), // Pointer to handle
54 SDL_SetError("Couldn't create mutex");
55 SDL_free(mutex);
56 mutex = NULL;
61 return(mutex);
64 /* Free the mutex */
65 DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex)
67 if ( mutex )
69 if ( mutex->hmtxID )
71 DosCloseMutexSem(mutex->hmtxID);
72 mutex->hmtxID = 0;
74 SDL_free(mutex);
78 /* Lock the mutex */
79 DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex)
81 if ( mutex == NULL )
83 SDL_SetError("Passed a NULL mutex");
86 if ( DosRequestMutexSem(mutex->hmtxID, SEM_INDEFINITE_WAIT) != NO_ERROR )
88 SDL_SetError("Couldn't wait on mutex");
94 /* Unlock the mutex */
95 DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex)
97 if ( mutex == NULL )
99 SDL_SetError("Passed a NULL mutex");
102 if ( DosReleaseMutexSem(mutex->hmtxID) != NO_ERROR )
104 SDL_SetError("Couldn't release mutex");