Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/openal-0.0.8/src/al_mutexlib.h @ 17

Last change on this file since 17 was 17, checked in by landauf, 16 years ago

added openal

File size: 1.3 KB
Line 
1/* -*- mode: C; tab-width:8; c-basic-offset:8 -*-
2 * vi:set ts=8:
3 *
4 * mutexlib.h
5 *
6 * Include that sorts out which mutex library we're using.
7 */
8#ifndef MUTEXLIB_H_
9#define MUTEXLIB_H_
10
11#include "al_siteconfig.h"
12
13#if defined(USE_EMPTY_LOCKS)
14
15#define _alCreateMutex()
16#define _alDestroyMutex(m)
17#define _alLockMutex(m)
18#define _alTryLockMutex(m)
19#define _alUnlockMutex(m)
20
21#else
22
23#if defined(USE_POSIXTHREADING)
24
25#include <pthread.h>
26typedef pthread_mutex_t *MutexID;
27
28#elif defined(USE_WINDOWSTHREADING)
29
30#include <windows.h>
31typedef LPCRITICAL_SECTION MutexID;
32
33#elif defined(USE_MORPHOSTHREADING)
34
35#include <exec/semaphores.h>
36typedef struct SignalSemaphore *MutexID;
37
38#else
39
40#error "No mutex package"
41
42#endif
43
44/* Creates a new mutex. Returns NULL on error. */
45extern MutexID _alCreateMutex( void );
46
47/* Destroys the given mutex, which must be unlocked. */
48extern void _alDestroyMutex( MutexID mutex );
49
50/* Locks the given mutex, blocking if it is already locked. */
51extern void _alLockMutex( MutexID mutex );
52
53/* Try to lock the given mutex, returning zero if it succeeded, non-zero
54   otherwise. Non-blocking. */
55extern int _alTryLockMutex( MutexID mutex );
56
57/* Unlocks the given mutex, which must be locked by the same thread. */
58extern void _alUnlockMutex( MutexID mutex );
59
60#endif                          /* USE_EMPTY_LOCKS */
61
62#endif                          /* MUTEXLIB_H_ */
Note: See TracBrowser for help on using the repository browser.