summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/mutex.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-05-22 19:06:12 -0400
committerGravatar bunnei2014-05-22 19:06:12 -0400
commitd26f3d4c1ff27f740fe7185e1bca7dcfc5851919 (patch)
treec6593a3d3044fbe4f183122d7d6f6b40f175b66c /src/core/hle/kernel/mutex.cpp
parentcore: moved armcopro.cpp to correct filter folder (arm/interpreter) (diff)
downloadyuzu-d26f3d4c1ff27f740fe7185e1bca7dcfc5851919.tar.gz
yuzu-d26f3d4c1ff27f740fe7185e1bca7dcfc5851919.tar.xz
yuzu-d26f3d4c1ff27f740fe7185e1bca7dcfc5851919.zip
kernel: refactored function naming to remove "__" prefix
Diffstat (limited to 'src/core/hle/kernel/mutex.cpp')
-rw-r--r--src/core/hle/kernel/mutex.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 7cf3439e9..019efbc78 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -30,17 +30,17 @@ public:
30typedef std::multimap<Handle, Handle> MutexMap; 30typedef std::multimap<Handle, Handle> MutexMap;
31static MutexMap g_mutex_held_locks; 31static MutexMap g_mutex_held_locks;
32 32
33void __MutexAcquireLock(Mutex* mutex, Handle thread) { 33void MutexAcquireLock(Mutex* mutex, Handle thread) {
34 g_mutex_held_locks.insert(std::make_pair(thread, mutex->GetHandle())); 34 g_mutex_held_locks.insert(std::make_pair(thread, mutex->GetHandle()));
35 mutex->lock_thread = thread; 35 mutex->lock_thread = thread;
36} 36}
37 37
38void __MutexAcquireLock(Mutex* mutex) { 38void MutexAcquireLock(Mutex* mutex) {
39 Handle thread = GetCurrentThread(); 39 Handle thread = GetCurrentThreadHandle();
40 __MutexAcquireLock(mutex, thread); 40 MutexAcquireLock(mutex, thread);
41} 41}
42 42
43void __MutexEraseLock(Mutex* mutex) { 43void MutexEraseLock(Mutex* mutex) {
44 Handle handle = mutex->GetHandle(); 44 Handle handle = mutex->GetHandle();
45 auto locked = g_mutex_held_locks.equal_range(mutex->lock_thread); 45 auto locked = g_mutex_held_locks.equal_range(mutex->lock_thread);
46 for (MutexMap::iterator iter = locked.first; iter != locked.second; ++iter) { 46 for (MutexMap::iterator iter = locked.first; iter != locked.second; ++iter) {
@@ -52,29 +52,29 @@ void __MutexEraseLock(Mutex* mutex) {
52 mutex->lock_thread = -1; 52 mutex->lock_thread = -1;
53} 53}
54 54
55bool __LockMutex(Mutex* mutex) { 55bool LockMutex(Mutex* mutex) {
56 // Mutex alread locked? 56 // Mutex alread locked?
57 if (mutex->locked) { 57 if (mutex->locked) {
58 return false; 58 return false;
59 } 59 }
60 __MutexAcquireLock(mutex); 60 MutexAcquireLock(mutex);
61 return true; 61 return true;
62} 62}
63 63
64bool __ReleaseMutexForThread(Mutex* mutex, Handle thread) { 64bool ReleaseMutexForThread(Mutex* mutex, Handle thread) {
65 __MutexAcquireLock(mutex, thread); 65 MutexAcquireLock(mutex, thread);
66 Kernel::ResumeThreadFromWait(thread); 66 Kernel::ResumeThreadFromWait(thread);
67 return true; 67 return true;
68} 68}
69 69
70bool __ReleaseMutex(Mutex* mutex) { 70bool ReleaseMutex(Mutex* mutex) {
71 __MutexEraseLock(mutex); 71 MutexEraseLock(mutex);
72 bool woke_threads = false; 72 bool woke_threads = false;
73 auto iter = mutex->waiting_threads.begin(); 73 auto iter = mutex->waiting_threads.begin();
74 74
75 // Find the next waiting thread for the mutex... 75 // Find the next waiting thread for the mutex...
76 while (!woke_threads && !mutex->waiting_threads.empty()) { 76 while (!woke_threads && !mutex->waiting_threads.empty()) {
77 woke_threads |= __ReleaseMutexForThread(mutex, *iter); 77 woke_threads |= ReleaseMutexForThread(mutex, *iter);
78 mutex->waiting_threads.erase(iter); 78 mutex->waiting_threads.erase(iter);
79 } 79 }
80 // Reset mutex lock thread handle, nothing is waiting 80 // Reset mutex lock thread handle, nothing is waiting
@@ -91,7 +91,7 @@ bool __ReleaseMutex(Mutex* mutex) {
91 */ 91 */
92Result ReleaseMutex(Handle handle) { 92Result ReleaseMutex(Handle handle) {
93 Mutex* mutex = Kernel::g_object_pool.GetFast<Mutex>(handle); 93 Mutex* mutex = Kernel::g_object_pool.GetFast<Mutex>(handle);
94 if (!__ReleaseMutex(mutex)) { 94 if (!ReleaseMutex(mutex)) {
95 return -1; 95 return -1;
96 } 96 }
97 return 0; 97 return 0;
@@ -110,7 +110,7 @@ Mutex* CreateMutex(Handle& handle, bool initial_locked) {
110 110
111 // Acquire mutex with current thread if initialized as locked... 111 // Acquire mutex with current thread if initialized as locked...
112 if (mutex->locked) { 112 if (mutex->locked) {
113 __MutexAcquireLock(mutex); 113 MutexAcquireLock(mutex);
114 114
115 // Otherwise, reset lock thread handle 115 // Otherwise, reset lock thread handle
116 } else { 116 } else {