]> git.vomp.tv Git - vompclient.git/commitdiff
Reverting changes in mutex
authorMarten Richter <marten.richter@freenet.de>
Tue, 28 Oct 2014 07:39:56 +0000 (08:39 +0100)
committerMarten Richter <marten.richter@freenet.de>
Tue, 28 Oct 2014 07:39:56 +0000 (08:39 +0100)
mutex.cc
mutex.h

index 7b36255171c89c0b7e80ffd3e34eb8b633366c0a..a9a32d4139dc5b6704e844eea0b1768cd0a91d9a 100644 (file)
--- a/mutex.cc
+++ b/mutex.cc
@@ -29,8 +29,6 @@ Mutex::Mutex() {
 #else
         my_mutex=CreateMutex(NULL,FALSE,NULL);
 #endif
-        my_cur_thread=0;
-        num_locks=0;
 }
 
 Mutex::~Mutex() {
@@ -40,40 +38,18 @@ Mutex::~Mutex() {
 }
 
 void Mutex::Lock() {
-       if (num_locks> 0) {
-#ifndef WIN32
-               if (my_cur_thread==(pid_t) syscall(SYS_gettid)) {
-#else
-               if (my_cur_thread==GetCurrentThreadId()) {
-#endif
-                       num_locks++;
-                       return;
-               }
-       }
 #ifndef WIN32
   pthread_mutex_lock(&my_mutex);
-  my_cur_thread=syscall(SYS_gettid);
 #else
    WaitForSingleObject(my_mutex, INFINITE );
-   my_cur_thread=GetCurrentThreadId();
 #endif
-   num_locks++;
-
 }
 
 void Mutex::Unlock() {
-#ifndef WIN32
-       if (my_cur_thread==syscall(SYS_gettid)) num_locks--;
-#else
-       if (my_cur_thread==GetCurrentThreadId()) num_locks--;
-#endif
-       if (num_locks==0) {
-               my_cur_thread=0;
 #ifndef WIN32
                pthread_mutex_unlock(&my_mutex);
 #else
                ReleaseMutex(my_mutex);
 #endif
-       }
 }
 
diff --git a/mutex.h b/mutex.h
index bab9f210414c88c7f05f8b504cbc71625475dfd4..21b04b7ab8d8f5c8ccfcd66fd02ad826eaefba5f 100644 (file)
--- a/mutex.h
+++ b/mutex.h
@@ -23,7 +23,6 @@
 
 #ifndef WIN32
 #include <pthread.h>
-#include <sys/types.h>
 #else
 #include <winsock2.h>
 #include <windows.h>
@@ -41,11 +40,8 @@ public:
 protected:
 #ifndef WIN32
         pthread_mutex_t my_mutex;
-        pid_t my_cur_thread;
 #else
        HANDLE my_mutex;
-       DWORD my_cur_thread;
 #endif
-       int num_locks;
 };
 #endif