comparison src/cdrom/macosx/SDLOSXCAGuard.h @ 1487:dc6b59e925a2

Cleaning up warnings on MacOS X
author Sam Lantinga <slouken@libsdl.org>
date Thu, 09 Mar 2006 06:33:21 +0000
parents d910939febfa
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
comparison
equal deleted inserted replaced
1486:9d77fc9d0ace 1487:dc6b59e925a2
67 67
68 =============================================================================*/ 68 =============================================================================*/
69 #if !defined(__CAGuard_h__) 69 #if !defined(__CAGuard_h__)
70 #define __CAGuard_h__ 70 #define __CAGuard_h__
71 71
72 //============================================================================= 72 /*=============================================================================
73 // Includes 73 Includes
74 //============================================================================= 74 =============================================================================*/
75 75
76 #include <CoreAudio/CoreAudioTypes.h> 76 #include <CoreAudio/CoreAudioTypes.h>
77 #include <pthread.h> 77 #include <pthread.h>
78 78
79 79
80 //============================================================================= 80 /*=============================================================================
81 // CAGuard 81 CAGuard
82 // 82
83 // This is your typical mutex with signalling implemented via pthreads. 83 This is your typical mutex with signalling implemented via pthreads.
84 // Lock() will return true if and only if the guard is locked on that call. 84 Lock() will return true if and only if the guard is locked on that call.
85 // A thread that already has the guard will receive 'false' if it locks it 85 A thread that already has the guard will receive 'false' if it locks it
86 // again. Use of the stack-based CAGuard::Locker class is highly recommended 86 again. Use of the stack-based CAGuard::Locker class is highly recommended
87 // to properly manage the recursive nesting. The Wait calls with timeouts 87 to properly manage the recursive nesting. The Wait calls with timeouts
88 // will return true if and only if the timeout period expired. They will 88 will return true if and only if the timeout period expired. They will
89 // return false if they receive notification any other way. 89 return false if they receive notification any other way.
90 //============================================================================= 90 =============================================================================*/
91 91
92 typedef struct S_SDLOSXCAGuard 92 typedef struct S_SDLOSXCAGuard
93 { 93 {
94 94
95 // Construction/Destruction 95 /* Construction/Destruction */
96 //public: 96 /*public:*/
97 // Actions 97 /* Actions */
98 //public: 98 /*public:*/
99 int (*Lock)(struct S_SDLOSXCAGuard *cag); 99 int (*Lock)(struct S_SDLOSXCAGuard *cag);
100 void (*Unlock)(struct S_SDLOSXCAGuard *cag); 100 void (*Unlock)(struct S_SDLOSXCAGuard *cag);
101 int (*Try)(struct S_SDLOSXCAGuard *cag, int *outWasLocked); // returns true if lock is free, false if not 101 int (*Try)(struct S_SDLOSXCAGuard *cag, int *outWasLocked); /* returns true if lock is free, false if not */
102 void (*Wait)(struct S_SDLOSXCAGuard *cag); 102 void (*Wait)(struct S_SDLOSXCAGuard *cag);
103 void (*Notify)(struct S_SDLOSXCAGuard *cag); 103 void (*Notify)(struct S_SDLOSXCAGuard *cag);
104 104
105 // Implementation 105 /* Implementation */
106 //protected: 106 /*protected:*/
107 pthread_mutex_t mMutex; 107 pthread_mutex_t mMutex;
108 pthread_cond_t mCondVar; 108 pthread_cond_t mCondVar;
109 pthread_t mOwner; 109 pthread_t mOwner;
110 } SDLOSXCAGuard; 110 } SDLOSXCAGuard;
111 111