Mercurial > sdl-ios-xcode
comparison src/thread/generic/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 | 450721ad5436 |
children | 604d73db6802 |
comparison
equal
deleted
inserted
replaced
1335:c39265384763 | 1336:3692456e7b0f |
---|---|
38 SDL_mutex *SDL_CreateMutex(void) | 38 SDL_mutex *SDL_CreateMutex(void) |
39 { | 39 { |
40 SDL_mutex *mutex; | 40 SDL_mutex *mutex; |
41 | 41 |
42 /* Allocate mutex memory */ | 42 /* Allocate mutex memory */ |
43 mutex = (SDL_mutex *)malloc(sizeof(*mutex)); | 43 mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex)); |
44 if ( mutex ) { | 44 if ( mutex ) { |
45 /* Create the mutex semaphore, with initial value 1 */ | 45 /* Create the mutex semaphore, with initial value 1 */ |
46 mutex->sem = SDL_CreateSemaphore(1); | 46 mutex->sem = SDL_CreateSemaphore(1); |
47 mutex->recursive = 0; | 47 mutex->recursive = 0; |
48 mutex->owner = 0; | 48 mutex->owner = 0; |
49 if ( ! mutex->sem ) { | 49 if ( ! mutex->sem ) { |
50 free(mutex); | 50 SDL_free(mutex); |
51 mutex = NULL; | 51 mutex = NULL; |
52 } | 52 } |
53 } else { | 53 } else { |
54 SDL_OutOfMemory(); | 54 SDL_OutOfMemory(); |
55 } | 55 } |
61 { | 61 { |
62 if ( mutex ) { | 62 if ( mutex ) { |
63 if ( mutex->sem ) { | 63 if ( mutex->sem ) { |
64 SDL_DestroySemaphore(mutex->sem); | 64 SDL_DestroySemaphore(mutex->sem); |
65 } | 65 } |
66 free(mutex); | 66 SDL_free(mutex); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 /* Lock the semaphore */ | 70 /* Lock the semaphore */ |
71 int SDL_mutexP(SDL_mutex *mutex) | 71 int SDL_mutexP(SDL_mutex *mutex) |