From ca212889b4ad7b5d3327bf52144f81892762097a Mon Sep 17 00:00:00 2001 From: James Benton Date: Thu, 7 Jan 2016 04:47:08 -0800 Subject: [PATCH] Move OSFastCondition to it's own header file. --- include/coreinit/fastcondition.h | 39 ++++++++++++++++++++++++++++++++ include/coreinit/fastmutex.h | 23 ------------------- rpl/libcoreinit/exports.h | 8 ++++--- 3 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 include/coreinit/fastcondition.h diff --git a/include/coreinit/fastcondition.h b/include/coreinit/fastcondition.h new file mode 100644 index 0000000..b5404ac --- /dev/null +++ b/include/coreinit/fastcondition.h @@ -0,0 +1,39 @@ +#pragma once +#include +#include "threadqueue.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OSFastCondition OSFastCondition; +typedef struct OSFastMutex OSFastMutex; + +#define OS_FAST_CONDITION_TAG 0x664E6456u + +struct OSFastCondition +{ + uint32_t tag; + const char *name; + UNKNOWN(4); + OSThreadQueue queue; +}; +CHECK_OFFSET(OSFastCondition, 0x00, tag); +CHECK_OFFSET(OSFastCondition, 0x04, name); +CHECK_OFFSET(OSFastCondition, 0x0c, queue); +CHECK_SIZE(OSFastCondition, 0x1c); + +void +OSFastCond_Init(OSFastCondition *condition, + const char *name); + +void +OSFastCond_Wait(OSFastCondition *condition, + OSFastMutex *mutex); + +void +OSFastCond_Signal(OSFastCondition *condition); + +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/fastmutex.h b/include/coreinit/fastmutex.h index fdf3656..0fe309a 100644 --- a/include/coreinit/fastmutex.h +++ b/include/coreinit/fastmutex.h @@ -36,20 +36,6 @@ CHECK_OFFSET(OSFastMutex, 0x0c, queue); CHECK_OFFSET(OSFastMutex, 0x14, link); CHECK_SIZE(OSFastMutex, 0x2c); -struct OSFastCondition -{ - static const uint32_t Tag = 0x664E6456; - - uint32_t tag; - const char *name; - UNKNOWN(4); - OSThreadQueue queue; -}; -CHECK_OFFSET(OSFastCondition, 0x00, tag); -CHECK_OFFSET(OSFastCondition, 0x04, name); -CHECK_OFFSET(OSFastCondition, 0x0c, queue); -CHECK_SIZE(OSFastCondition, 0x1c); - void OSFastMutex_Init(OSFastMutex *mutex, const char *name); @@ -62,15 +48,6 @@ OSFastMutex_Unlock(OSFastMutex *mutex); BOOL OSFastMutex_TryLock(OSFastMutex *mutex); -void -OSFastCond_Init(OSFastCondition *condition, const char *name); - -void -OSFastCond_Wait(OSFastCondition *condition, OSFastMutex *mutex); - -void -OSFastCond_Signal(OSFastCondition *condition); - #ifdef __cplusplus } #endif diff --git a/rpl/libcoreinit/exports.h b/rpl/libcoreinit/exports.h index 433aeb7..7d96a72 100644 --- a/rpl/libcoreinit/exports.h +++ b/rpl/libcoreinit/exports.h @@ -76,14 +76,16 @@ EXPORT(OSSetExceptionCallbackEx); EXPORT(exit); EXPORT(_Exit); +// coreinit/fastcondition.h +EXPORT(OSFastCond_Init); +EXPORT(OSFastCond_Wait); +EXPORT(OSFastCond_Signal); + // coreinit/fastmutex.h EXPORT(OSFastMutex_Init); EXPORT(OSFastMutex_Lock); EXPORT(OSFastMutex_Unlock); EXPORT(OSFastMutex_TryLock); -EXPORT(OSFastCond_Init); -EXPORT(OSFastCond_Wait); -EXPORT(OSFastCond_Signal); // coreinit/memexpandedheap.h EXPORT(MEMCreateExpHeap);