NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
ut_lock.h
1
#ifndef NW4R_UT_LOCK_H
2
#define NW4R_UT_LOCK_H
3
#include <nw4r/types_nw4r.h>
4
5
#include <nw4r/ut/ut_NonCopyable.h>
6
7
#include <revolution/OS.h>
8
9
namespace
nw4r {
10
namespace
ut
{
11
namespace
detail {
12
13
/******************************************************************************
14
*
15
* Mutex lock functions
16
*
17
******************************************************************************/
18
inline
void
Lock(OSMutex& rMutex) {
19
OSLockMutex(&rMutex);
20
}
21
inline
void
Unlock(OSMutex& rMutex) {
22
OSUnlockMutex(&rMutex);
23
}
24
25
/******************************************************************************
26
*
27
* AutoLock
28
*
29
******************************************************************************/
30
template
<
typename
T>
class
AutoLock :
private
NonCopyable {
31
public
:
32
explicit
AutoLock(T& rLockObj) : mLockObj(rLockObj) {
33
Lock(mLockObj);
34
}
35
~AutoLock() {
36
Unlock(mLockObj);
37
}
38
39
private
:
40
T& mLockObj;
// at 0x0
41
};
42
43
}
// namespace detail
44
45
/******************************************************************************
46
*
47
* AutoInterruptLock
48
*
49
******************************************************************************/
50
class
AutoInterruptLock :
private
NonCopyable {
51
public
:
52
AutoInterruptLock() : mOldState(OSDisableInterrupts()) {}
53
~AutoInterruptLock() {
54
OSRestoreInterrupts(mOldState);
55
}
56
57
private
:
58
BOOL mOldState;
// at 0x0
59
};
60
61
}
// namespace ut
62
}
// namespace nw4r
63
64
#endif
nw4r::ut
Debugging library which includes various utilities used by the rest of nw4r.
Definition
ut_list.cpp:4
include
lib
nw4r
ut
ut_lock.h
Made with ❤️ by
CLF78
and
RootCubed
. Logos by
Chasical
and
B1
. Website generated by
Doxygen
1.13.2