X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbctrace.h;h=e92c09760ff74c497e20daefb0c1dab95169a502;hb=58d99c74e65066486dbebf7e1cb3087e7de1c92b;hp=e510c3105e78b7276bf9b88da6f30923949e4c9b;hpb=21c2e6b36d6a96c2f662a89459d607b5a387f4eb;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bctrace.h b/cinelerra-5.1/guicast/bctrace.h index e510c310..e92c0976 100644 --- a/cinelerra-5.1/guicast/bctrace.h +++ b/cinelerra-5.1/guicast/bctrace.h @@ -179,19 +179,24 @@ public: void lock() { pthread_mutex_lock(&the_lock); } void unlock() { pthread_mutex_unlock(&the_lock); } - TheLock() { + void init() { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutex_init(&the_lock, &attr); } - ~TheLock() { + void finit() { pthread_mutex_destroy(&the_lock); } + void reset() { finit(); init(); } + + TheLock() { init(); } + ~TheLock() { finit(); } }; class TheLocker { public: static TheLock the_lock; + static void reset() { the_lock.reset(); } TheLocker() { the_lock.lock(); } ~TheLocker() { the_lock.unlock(); } @@ -211,12 +216,9 @@ public: static void dump_threads(FILE *fp); static void dbg_add(pthread_t tid, pthread_t owner, const char *nm); static void dbg_del(pthread_t tid); - + static void reset() { the_list.remove_all_objects(); TheLocker::reset(); } TheList() {} - ~TheList() { - TheLocker the_locker; - remove_all_objects(); - } + ~TheList() { reset(); } }; class TheChk {