mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-22 16:04:20 +01:00
Define macros wrappers for logs
Use macros to wrap SDL_Log* functions with the "application" category.
This commit is contained in:
@@ -1,31 +1,32 @@
|
||||
#include <stdlib.h>
|
||||
#include <SDL2/SDL_log.h>
|
||||
#include <SDL2/SDL_mutex.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
void mutex_lock(SDL_mutex *mutex) {
|
||||
if (SDL_LockMutex(mutex)) {
|
||||
SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "Could not lock mutex");
|
||||
LOGC("Could not lock mutex");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void mutex_unlock(SDL_mutex *mutex) {
|
||||
if (SDL_UnlockMutex(mutex)) {
|
||||
SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "Could not unlock mutex");
|
||||
LOGC("Could not unlock mutex");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void cond_wait(SDL_cond *cond, SDL_mutex *mutex) {
|
||||
if (SDL_CondWait(cond, mutex)) {
|
||||
SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "Could not wait on condition");
|
||||
LOGC("Could not wait on condition");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void cond_signal(SDL_cond *cond) {
|
||||
if (SDL_CondSignal(cond)) {
|
||||
SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "Could not signal a condition");
|
||||
LOGC("Could not signal a condition");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user