Merge branch 'master' of git://git.ucc.asn.au/tpg/acess2
[tpg/acess2.git] / Usermode / Libraries / libc++.so_src / mutex.cc
diff --git a/Usermode/Libraries/libc++.so_src/mutex.cc b/Usermode/Libraries/libc++.so_src/mutex.cc
new file mode 100644 (file)
index 0000000..5ff27df
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * mutex.cc
+ * - ::std::mutex and helpers
+ */
+#include <mutex>
+#include <system_error>
+#include <cerrno>
+
+// === CODE ===
+::std::mutex::~mutex()
+{
+       
+}
+
+void ::std::mutex::lock()
+{
+       if( m_flag )
+       {
+               _sys::debug("TODO: userland mutexes");
+               throw ::std::system_error(ENOTIMPL, ::std::system_category());
+       }
+       m_flag = true;
+}
+
+bool ::std::mutex::try_lock()
+{
+       bool rv = m_flag;
+       m_flag = true;
+       return !rv;
+}
+
+void ::std::mutex::unlock()
+{
+       m_flag = false;
+}
+

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