Usermode/libc++ - Implement map::insert and map::erase
[tpg/acess2.git] / Usermode / Libraries / libc++.so_src / mutex.cc
1 /*
2  * Acess2 C++ Library
3  * - By John Hodge (thePowersGang)
4  *
5  * mutex.cc
6  * - ::std::mutex and helpers
7  */
8 #include <mutex>
9 #include <system_error>
10 #include <cerrno>
11
12 // === CODE ===
13 ::std::mutex::~mutex()
14 {
15         
16 }
17
18 void ::std::mutex::lock()
19 {
20         if( m_flag )
21         {
22                 _sys::debug("TODO: userland mutexes");
23                 throw ::std::system_error(ENOTIMPL, ::std::system_category());
24         }
25         m_flag = true;
26 }
27
28 bool ::std::mutex::try_lock()
29 {
30         bool rv = m_flag;
31         m_flag = true;
32         return !rv;
33 }
34
35 void ::std::mutex::unlock()
36 {
37         m_flag = false;
38 }
39

UCC git Repository :: git.ucc.asn.au