|
@@ -86,13 +86,13 @@ static void addToHistory() {
|
|
|
|
|
|
static void lock() {
|
|
|
if(mtx_lock(&bufferMutex) != thrd_success || MUTEX_LOCK_FAIL) {
|
|
|
- LOG_WARNING("could not lock buffer mutex");
|
|
|
+ REPORT(LOG_WARNING, "could not lock buffer mutex");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void unlock() {
|
|
|
if(mtx_unlock(&bufferMutex) != thrd_success || MUTEX_UNLOCK_FAIL) {
|
|
|
- LOG_WARNING("could not unlock buffer mutex");
|
|
|
+ REPORT(LOG_WARNING, "could not unlock buffer mutex");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -221,18 +221,18 @@ static int loop(void* data) {
|
|
|
|
|
|
bool startReadLine(void) {
|
|
|
if(enterRawTerminal()) {
|
|
|
- LOG_WARNING("cannot set terminal attributes");
|
|
|
+ REPORT(LOG_WARNING, "cannot set terminal attributes");
|
|
|
}
|
|
|
initQueueCL(&buffer, 10);
|
|
|
atomic_store(&running, true);
|
|
|
if(MUTEX_INIT_FAIL || mtx_init(&bufferMutex, mtx_plain) != thrd_success) {
|
|
|
- LOG_ERROR("cannot init buffer mutex");
|
|
|
+ REPORT(LOG_ERROR, "cannot init buffer mutex");
|
|
|
stopReadLine();
|
|
|
return true;
|
|
|
} else if(
|
|
|
THREAD_INIT_FAIL ||
|
|
|
thrd_create(&readThread, loop, nullptr) != thrd_success) {
|
|
|
- LOG_ERROR("cannot start read thread");
|
|
|
+ REPORT(LOG_ERROR, "cannot start read thread");
|
|
|
stopReadLine();
|
|
|
return true;
|
|
|
}
|
|
@@ -255,7 +255,7 @@ void stopReadLine() {
|
|
|
atomic_store(&running, false);
|
|
|
joinThreadSafe(&readThread);
|
|
|
if(leaveRawTerminal()) {
|
|
|
- LOG_WARNING("cannot restore terminal attributes");
|
|
|
+ REPORT(LOG_WARNING, "cannot restore terminal attributes");
|
|
|
}
|
|
|
destroyQueueCL(&buffer);
|
|
|
mtx_destroy(&bufferMutex);
|