mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-30 07:01:35 +02:00
initialize mutex (needed on macos apparently and not on linux)
This commit is contained in:
parent
fb5970b000
commit
29bb2dcc5f
16
src/btop.cpp
16
src/btop.cpp
@ -296,7 +296,7 @@ namespace Runner {
|
|||||||
pthread_mutex_t& pt_mutex;
|
pthread_mutex_t& pt_mutex;
|
||||||
public:
|
public:
|
||||||
int status;
|
int status;
|
||||||
thread_lock(pthread_mutex_t& mtx) : pt_mutex(mtx) { status = pthread_mutex_lock(&pt_mutex); }
|
thread_lock(pthread_mutex_t& mtx) : pt_mutex(mtx) { pthread_mutex_init(&mtx, NULL); status = pthread_mutex_lock(&pt_mutex); }
|
||||||
~thread_lock() { if (status == 0) pthread_mutex_unlock(&pt_mutex); }
|
~thread_lock() { if (status == 0) pthread_mutex_unlock(&pt_mutex); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -381,13 +381,13 @@ namespace Runner {
|
|||||||
|
|
||||||
//? pthread_mutex_lock to lock thread and monitor health from main thread
|
//? pthread_mutex_lock to lock thread and monitor health from main thread
|
||||||
thread_lock pt_lck(mtx);
|
thread_lock pt_lck(mtx);
|
||||||
// if (pt_lck.status != 0) {
|
if (pt_lck.status != 0) {
|
||||||
// Logger::error("exception in runner thread - set stopping");
|
Global::exit_error_msg = "Exception in runner thread -> pthread_mutex_lock error id: " + to_string(pt_lck.status);
|
||||||
// Global::exit_error_msg = "Exception in runner thread -> pthread_mutex_lock error id: " + to_string(pt_lck.status);
|
Logger::error(Global::exit_error_msg);
|
||||||
// Global::thread_exception = true;
|
Global::thread_exception = true;
|
||||||
// Input::interrupt = true;
|
Input::interrupt = true;
|
||||||
// stopping = true;
|
stopping = true;
|
||||||
// }
|
}
|
||||||
|
|
||||||
//* ----------------------------------------------- THREAD LOOP -----------------------------------------------
|
//* ----------------------------------------------- THREAD LOOP -----------------------------------------------
|
||||||
while (not Global::quitting) {
|
while (not Global::quitting) {
|
||||||
|
Loading…
Reference in New Issue
Block a user