2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _DOLPHIN_OSMUTEX
|
|
|
|
#define _DOLPHIN_OSMUTEX
|
2022-09-13 04:26:54 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#include "dolphin/os/OSThread.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct OSMutex {
|
|
|
|
OSThreadQueue queue;
|
|
|
|
OSThread* thread; // the current owner
|
|
|
|
s32 count; // lock count
|
|
|
|
OSMutexLink link; // for OSThread.queueMutex
|
|
|
|
};
|
|
|
|
|
2022-12-18 04:08:25 +00:00
|
|
|
struct OSCond {
|
|
|
|
OSThreadQueue queue;
|
|
|
|
};
|
|
|
|
|
|
|
|
void OSInitMutex(OSMutex* mutex);
|
|
|
|
void OSLockMutex(OSMutex* mutex);
|
|
|
|
void OSUnlockMutex(OSMutex* mutex);
|
|
|
|
BOOL OSTryLockMutex(OSMutex* mutex);
|
|
|
|
void OSInitCond(OSCond* cond);
|
|
|
|
void OSWaitCond(OSCond* cond, OSMutex* mutex);
|
|
|
|
void OSSignalCond(OSCond* cond);
|
|
|
|
|
2022-09-13 04:26:54 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _DOLPHIN_OSMUTEX
|