wut/include/coreinit/spinlock.h

62 lines
1.1 KiB
C
Raw Normal View History

2016-01-07 12:07:13 +00:00
#pragma once
#include <wut.h>
#include "time.h"
2016-01-07 16:02:54 +00:00
/**
* \defgroup coreinit_spinlock Spinlock
* \ingroup coreinit
* @{
*/
2016-01-07 14:09:43 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2016-01-07 12:07:13 +00:00
typedef struct OSSpinLock OSSpinLock;
struct WUT_ALIGNAS(16) OSSpinLock
2016-01-07 12:07:13 +00:00
{
uint32_t owner;
2018-06-20 10:31:53 +01:00
WUT_UNKNOWN_BYTES(0x4);
2016-01-07 12:07:13 +00:00
uint32_t recursion;
2018-06-20 10:31:53 +01:00
WUT_UNKNOWN_BYTES(0x4);
2016-01-07 12:07:13 +00:00
};
2018-06-20 10:31:53 +01:00
WUT_CHECK_OFFSET(OSSpinLock, 0x0, owner);
WUT_CHECK_OFFSET(OSSpinLock, 0x8, recursion);
WUT_CHECK_SIZE(OSSpinLock, 0x10);
2016-01-07 12:07:13 +00:00
void
OSInitSpinLock(OSSpinLock *spinlock);
BOOL
OSAcquireSpinLock(OSSpinLock *spinlock);
BOOL
OSTryAcquireSpinLock(OSSpinLock *spinlock);
BOOL
OSTryAcquireSpinLockWithTimeout(OSSpinLock *spinlock,
OSTime timeout);
BOOL
OSReleaseSpinLock(OSSpinLock *spinlock);
BOOL
OSUninterruptibleSpinLock_Acquire(OSSpinLock *spinlock);
BOOL
OSUninterruptibleSpinLock_TryAcquire(OSSpinLock *spinlock);
BOOL
OSUninterruptibleSpinLock_TryAcquireWithTimeout(OSSpinLock *spinlock,
OSTime timeout);
BOOL
OSUninterruptibleSpinLock_Release(OSSpinLock *spinlock);
2016-01-07 14:09:43 +00:00
#ifdef __cplusplus
}
#endif
2016-01-07 16:02:54 +00:00
/** @} */