1 /*---------------------------------------------------------------------------* 2 Project: Dolphin OS Mutex API 3 File: OSMutex.h 4 5 Copyright 1998, 1999 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: OSMutex.h,v $ 14 Revision 1.2 2006/02/04 11:56:47 hashida 15 (none) 16 17 Revision 1.1.1.1 2005/12/29 06:53:28 hiratsu 18 Initial import. 19 20 Revision 1.1.1.1 2005/05/12 02:41:07 yasuh-to 21 Ported from dolphin source tree. 22 23 24 4 2000/01/27 2:57p Shiki 25 Added /link/ member in OSMutex for implementing BPI protocol. 26 27 2 2000/01/25 6:42p Shiki 28 Clean up. 29 30 1 2000/01/18 6:16p Shiki 31 Initial check-in. 32 $NoKeywords: $ 33 *---------------------------------------------------------------------------*/ 34 35 #ifndef __OSMUTEX_H__ 36 #define __OSMUTEX_H__ 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 #include <revolution/os/OSThread.h> 43 44 struct OSMutex 45 { 46 OSThreadQueue queue; 47 OSThread* thread; // The current owner 48 s32 count; // Lock count 49 OSMutexLink link; // For OSThread.queueMutex 50 }; 51 52 struct OSCond 53 { 54 OSThreadQueue queue; 55 }; 56 57 void OSInitMutex ( OSMutex* mutex ); 58 void OSLockMutex ( OSMutex* mutex ); 59 void OSUnlockMutex ( OSMutex* mutex ); 60 BOOL OSTryLockMutex( OSMutex* mutex ); 61 void OSInitCond ( OSCond* cond ); 62 void OSWaitCond ( OSCond* cond, OSMutex* mutex ); 63 void OSSignalCond ( OSCond* cond ); 64 65 #ifdef __cplusplus 66 } 67 #endif 68 69 #endif // __OSMUTEX_H__ 70