comparison src/thread/os2/SDL_sysmutex.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
41 { 41 {
42 SDL_mutex *mutex; 42 SDL_mutex *mutex;
43 APIRET ulrc; 43 APIRET ulrc;
44 44
45 /* Allocate mutex memory */ 45 /* Allocate mutex memory */
46 mutex = (SDL_mutex *)malloc(sizeof(*mutex)); 46 mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex));
47 if (mutex) 47 if (mutex)
48 { 48 {
49 /* Create the mutex, with initial value signaled */ 49 /* Create the mutex, with initial value signaled */
50 ulrc = DosCreateMutexSem(NULL, // Create unnamed semaphore 50 ulrc = DosCreateMutexSem(NULL, // Create unnamed semaphore
51 &(mutex->hmtxID), // Pointer to handle 51 &(mutex->hmtxID), // Pointer to handle
52 0L, // Flags: create it private (not shared) 52 0L, // Flags: create it private (not shared)
53 FALSE); // Initial value: unowned 53 FALSE); // Initial value: unowned
54 if (ulrc!=NO_ERROR) 54 if (ulrc!=NO_ERROR)
55 { 55 {
56 SDL_SetError("Couldn't create mutex"); 56 SDL_SetError("Couldn't create mutex");
57 free(mutex); 57 SDL_free(mutex);
58 mutex = NULL; 58 mutex = NULL;
59 } 59 }
60 } else { 60 } else {
61 SDL_OutOfMemory(); 61 SDL_OutOfMemory();
62 } 62 }
71 if ( mutex->hmtxID ) 71 if ( mutex->hmtxID )
72 { 72 {
73 DosCloseMutexSem(mutex->hmtxID); 73 DosCloseMutexSem(mutex->hmtxID);
74 mutex->hmtxID = 0; 74 mutex->hmtxID = 0;
75 } 75 }
76 free(mutex); 76 SDL_free(mutex);
77 } 77 }
78 } 78 }
79 79
80 /* Lock the mutex */ 80 /* Lock the mutex */
81 DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex) 81 DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex)