diff --git a/libtest/signal.cc b/libtest/signal.cc index 24a40b1b6..93176da8d 100644 --- a/libtest/signal.cc +++ b/libtest/signal.cc @@ -87,7 +87,7 @@ shutdown_t SignalThread::get_shutdown() void SignalThread::post() { - sem_post(&lock); + sem_post(lock); } void SignalThread::test() @@ -131,7 +131,7 @@ SignalThread::~SignalThread() pthread_join(thread, &retval); } #endif - sem_destroy(&lock); + sem_close(lock); unblock(); } @@ -265,7 +265,7 @@ bool SignalThread::setup() return false; } - sem_wait(&lock); + sem_wait(lock); return true; } diff --git a/libtest/signal.h b/libtest/signal.h index 6e68bb387..47390eb4e 100644 --- a/libtest/signal.h +++ b/libtest/signal.h @@ -50,7 +50,8 @@ namespace libtest { class SignalThread { sigset_t set; - sem_t lock; + char lock_name[10]; + sem_t *lock; uint64_t magic_memory; volatile shutdown_t __shutdown; pthread_mutex_t shutdown_mutex; diff --git a/util/signal.cc b/util/signal.cc index 922671067..adf78b7a3 100644 --- a/util/signal.cc +++ b/util/signal.cc @@ -35,6 +35,8 @@ */ #include "gear_config.h" +#include +#include #include #include @@ -88,7 +90,7 @@ shutdown_t SignalThread::get_shutdown() void SignalThread::post() { - sem_post(&lock); + sem_post(lock); } void SignalThread::test() @@ -129,7 +131,7 @@ SignalThread::~SignalThread() pthread_join(thread, &retval); } #endif - sem_destroy(&lock); + sem_close(lock); } extern "C" {