Mercurial > sdl-ios-xcode
comparison src/thread/pth/SDL_sysmutex.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
32 #include "SDL_mutex.h" | 32 #include "SDL_mutex.h" |
33 #include "SDL_sysmutex_c.h" | 33 #include "SDL_sysmutex_c.h" |
34 | 34 |
35 /* Create a mutex */ | 35 /* Create a mutex */ |
36 SDL_mutex * | 36 SDL_mutex * |
37 SDL_CreateMutex (void) | 37 SDL_CreateMutex(void) |
38 { | 38 { |
39 SDL_mutex *mutex; | 39 SDL_mutex *mutex; |
40 | 40 |
41 /* Allocate mutex memory */ | 41 /* Allocate mutex memory */ |
42 mutex = (SDL_mutex *) SDL_malloc (sizeof (*mutex)); | 42 mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex)); |
43 if (mutex) { | 43 if (mutex) { |
44 /* Create the mutex, with initial value signaled */ | 44 /* Create the mutex, with initial value signaled */ |
45 if (!pth_mutex_init (&(mutex->mutexpth_p))) { | 45 if (!pth_mutex_init(&(mutex->mutexpth_p))) { |
46 SDL_SetError ("Couldn't create mutex"); | 46 SDL_SetError("Couldn't create mutex"); |
47 SDL_free (mutex); | 47 SDL_free(mutex); |
48 mutex = NULL; | 48 mutex = NULL; |
49 } | 49 } |
50 } else { | 50 } else { |
51 SDL_OutOfMemory (); | 51 SDL_OutOfMemory(); |
52 } | 52 } |
53 return (mutex); | 53 return (mutex); |
54 } | 54 } |
55 | 55 |
56 /* Free the mutex */ | 56 /* Free the mutex */ |
57 void | 57 void |
58 SDL_DestroyMutex (SDL_mutex * mutex) | 58 SDL_DestroyMutex(SDL_mutex * mutex) |
59 { | 59 { |
60 if (mutex) { | 60 if (mutex) { |
61 SDL_free (mutex); | 61 SDL_free(mutex); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 /* Lock the mutex */ | 65 /* Lock the mutex */ |
66 int | 66 int |
67 SDL_mutexP (SDL_mutex * mutex) | 67 SDL_mutexP(SDL_mutex * mutex) |
68 { | 68 { |
69 if (mutex == NULL) { | 69 if (mutex == NULL) { |
70 SDL_SetError ("Passed a NULL mutex"); | 70 SDL_SetError("Passed a NULL mutex"); |
71 return -1; | 71 return -1; |
72 } | 72 } |
73 | 73 |
74 pth_mutex_acquire (&(mutex->mutexpth_p), FALSE, NULL); | 74 pth_mutex_acquire(&(mutex->mutexpth_p), FALSE, NULL); |
75 | 75 |
76 return (0); | 76 return (0); |
77 } | 77 } |
78 | 78 |
79 /* Unlock the mutex */ | 79 /* Unlock the mutex */ |
80 int | 80 int |
81 SDL_mutexV (SDL_mutex * mutex) | 81 SDL_mutexV(SDL_mutex * mutex) |
82 { | 82 { |
83 if (mutex == NULL) { | 83 if (mutex == NULL) { |
84 SDL_SetError ("Passed a NULL mutex"); | 84 SDL_SetError("Passed a NULL mutex"); |
85 return -1; | 85 return -1; |
86 } | 86 } |
87 | 87 |
88 pth_mutex_release (&(mutex->mutexpth_p)); | 88 pth_mutex_release(&(mutex->mutexpth_p)); |
89 | 89 |
90 return (0); | 90 return (0); |
91 } | 91 } |
92 | 92 |
93 /* vi: set ts=4 sw=4 expandtab: */ | 93 /* vi: set ts=4 sw=4 expandtab: */ |