2016-01-07 13:07:13 +01:00
|
|
|
#pragma once
|
|
|
|
#include <wut.h>
|
|
|
|
#include "threadqueue.h"
|
|
|
|
|
2016-01-07 17:02:54 +01:00
|
|
|
/**
|
|
|
|
* \defgroup coreinit_semaphore Semaphore
|
|
|
|
* \ingroup coreinit
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2016-01-07 15:09:43 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2016-01-07 13:07:13 +01:00
|
|
|
|
|
|
|
typedef struct OSSemaphore OSSemaphore;
|
|
|
|
|
2016-01-07 13:44:44 +01:00
|
|
|
#define OS_SEMAPHORE_TAG 0x73506852u
|
|
|
|
|
2016-01-07 13:07:13 +01:00
|
|
|
struct OSSemaphore
|
|
|
|
{
|
|
|
|
uint32_t tag;
|
|
|
|
const char *name;
|
|
|
|
UNKNOWN(4);
|
|
|
|
int32_t count;
|
|
|
|
OSThreadQueue queue;
|
|
|
|
};
|
|
|
|
CHECK_OFFSET(OSSemaphore, 0x00, tag);
|
|
|
|
CHECK_OFFSET(OSSemaphore, 0x04, name);
|
|
|
|
CHECK_OFFSET(OSSemaphore, 0x0C, count);
|
|
|
|
CHECK_OFFSET(OSSemaphore, 0x10, queue);
|
|
|
|
CHECK_SIZE(OSSemaphore, 0x20);
|
|
|
|
|
|
|
|
void
|
|
|
|
OSInitSemaphore(OSSemaphore *semaphore,
|
|
|
|
int32_t count);
|
|
|
|
|
|
|
|
void
|
|
|
|
OSInitSemaphoreEx(OSSemaphore *semaphore,
|
|
|
|
int32_t count,
|
|
|
|
const char *name);
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
OSGetSemaphoreCount(OSSemaphore *semaphore);
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
OSSignalSemaphore(OSSemaphore *semaphore);
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
OSWaitSemaphore(OSSemaphore *semaphore);
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
OSTryWaitSemaphore(OSSemaphore *semaphore);
|
|
|
|
|
2016-01-07 15:09:43 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2016-01-07 17:02:54 +01:00
|
|
|
|
|
|
|
/** @} */
|