projects
/
goodguy
/
history.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sams folder icons, snap drag, sort folders, in/out ptr bug, interp bg fix, filebox...
[goodguy/history.git]
/
cinelerra-5.1
/
guicast
/
mutex.C
diff --git
a/cinelerra-5.1/guicast/mutex.C
b/cinelerra-5.1/guicast/mutex.C
index a4a6e21f99f605c1e30fe7a7ffb6092cad5ab40b..c6cddd7639827ea6ddb89df9629d02a16a58dc04 100644
(file)
--- a/
cinelerra-5.1/guicast/mutex.C
+++ b/
cinelerra-5.1/guicast/mutex.C
@@
-22,15
+22,14
@@
#include <stdio.h>
#include <errno.h>
#include <stdio.h>
#include <errno.h>
-#ifndef NO_GUICAST
#include "bcsignals.h"
#include "bcsignals.h"
-#endif
#include "mutex.h"
Mutex::Mutex(const char *title, int recursive)
{
this->title = title;
#include "mutex.h"
Mutex::Mutex(const char *title, int recursive)
{
this->title = title;
+ this->trace = 0;
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex, &attr);
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex, &attr);
@@
-45,9
+44,7
@@
Mutex::~Mutex()
{
pthread_mutex_destroy(&mutex);
pthread_mutex_destroy(&recursive_lock);
{
pthread_mutex_destroy(&mutex);
pthread_mutex_destroy(&recursive_lock);
-#ifndef NO_GUICAST
UNSET_ALL_LOCKS(this);
UNSET_ALL_LOCKS(this);
-#endif
}
int Mutex::lock(const char *location)
}
int Mutex::lock(const char *location)
@@
-66,9
+63,7
@@
int Mutex::lock(const char *location)
}
}
-#ifndef NO_GUICAST
SET_LOCK(this, title, location);
SET_LOCK(this, title, location);
-#endif
if(pthread_mutex_lock(&mutex)) perror("Mutex::lock");
if(pthread_mutex_lock(&mutex)) perror("Mutex::lock");
@@
-88,14
+83,16
@@
int Mutex::lock(const char *location)
}
}
-#ifndef NO_GUICAST
SET_LOCK2
SET_LOCK2
-#endif
return 0;
}
int Mutex::unlock()
{
return 0;
}
int Mutex::unlock()
{
+ if( count <= 0 ) {
+ printf("Mutex::unlock not locked: %s\n", title);
+ return 0;
+ }
// Remove from recursive status
if(recursive)
{
// Remove from recursive status
if(recursive)
{
@@
-116,9
+113,7
@@
int Mutex::unlock()
count = 0;
count = 0;
-#ifndef NO_GUICAST
UNSET_LOCK(this);
UNSET_LOCK(this);
-#endif
if(pthread_mutex_unlock(&mutex)) perror("Mutex::unlock");
return 0;
if(pthread_mutex_unlock(&mutex)) perror("Mutex::unlock");
return 0;
@@
-141,10
+136,8
@@
int Mutex::trylock(const char *location)
else
count = 1;
else
count = 1;
-#ifndef NO_GUICAST
SET_LOCK(this, title, location);
SET_LOCK2
SET_LOCK(this, title, location);
SET_LOCK2
-#endif
return 0;
}
return 0;
}
@@
-159,11
+152,10
@@
int Mutex::reset()
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex, &attr);
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex, &attr);
+ UNSET_ALL_LOCKS(this)
+ trace = 0;
count = 0;
thread_id = 0;
thread_id_valid = 0;
count = 0;
thread_id = 0;
thread_id_valid = 0;
-#ifndef NO_GUICAST
- UNSET_ALL_LOCKS(this)
-#endif
return 0;
}
return 0;
}