AuroraOpenALSoft/Alc/uintmap.h

35 lines
859 B
C
Raw Normal View History

2013-10-28 19:48:13 +00:00
#ifndef AL_UINTMAP_H
#define AL_UINTMAP_H
#include "AL/al.h"
#include "rwlock.h"
typedef struct UIntMap {
struct {
ALuint key;
ALvoid *value;
} *array;
ALsizei size;
ALsizei maxsize;
ALsizei limit;
RWLock lock;
} UIntMap;
extern UIntMap TlsDestructor;
void InitUIntMap(UIntMap *map, ALsizei limit);
void ResetUIntMap(UIntMap *map);
ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key);
ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
2013-11-04 20:12:31 +00:00
inline void LockUIntMapRead(UIntMap *map)
2013-10-28 19:48:13 +00:00
{ ReadLock(&map->lock); }
2013-11-04 20:12:31 +00:00
inline void UnlockUIntMapRead(UIntMap *map)
2013-10-28 19:48:13 +00:00
{ ReadUnlock(&map->lock); }
2013-11-04 20:12:31 +00:00
inline void LockUIntMapWrite(UIntMap *map)
2013-10-28 19:48:13 +00:00
{ WriteLock(&map->lock); }
2013-11-04 20:12:31 +00:00
inline void UnlockUIntMapWrite(UIntMap *map)
2013-10-28 19:48:13 +00:00
{ WriteUnlock(&map->lock); }
#endif /* AL_UINTMAP_H */