mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Enable threaded logging on OSX
This commit is contained in:
parent
a8e19205dc
commit
fd17477f06
|
@ -108,7 +108,6 @@ void dbg_break_imp()
|
||||||
*((volatile unsigned*)0) = 0x0;
|
*((volatile unsigned*)0) = 0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(CONF_PLATFORM_MACOSX)
|
|
||||||
#define QUEUE_SIZE 64
|
#define QUEUE_SIZE 64
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -185,7 +184,6 @@ void dbg_enable_threaded()
|
||||||
Thread = thread_init(dbg_msg_thread, 0);
|
Thread = thread_init(dbg_msg_thread, 0);
|
||||||
thread_detach(Thread);
|
thread_detach(Thread);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void dbg_msg(const char *sys, const char *fmt, ...)
|
void dbg_msg(const char *sys, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +195,6 @@ void dbg_msg(const char *sys, const char *fmt, ...)
|
||||||
char timestr[80];
|
char timestr[80];
|
||||||
str_timestamp_format(timestr, sizeof(timestr), FORMAT_SPACE);
|
str_timestamp_format(timestr, sizeof(timestr), FORMAT_SPACE);
|
||||||
|
|
||||||
#if !defined(CONF_PLATFORM_MACOSX)
|
|
||||||
if(dbg_msg_threaded)
|
if(dbg_msg_threaded)
|
||||||
{
|
{
|
||||||
semaphore_wait(&log_queue.mutex);
|
semaphore_wait(&log_queue.mutex);
|
||||||
|
@ -232,7 +229,6 @@ void dbg_msg(const char *sys, const char *fmt, ...)
|
||||||
semaphore_signal(&log_queue.mutex);
|
semaphore_signal(&log_queue.mutex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char str[1024*4];
|
char str[1024*4];
|
||||||
int i;
|
int i;
|
||||||
|
@ -283,16 +279,14 @@ static void logger_file(const char *line)
|
||||||
|
|
||||||
void dbg_logger(DBG_LOGGER logger)
|
void dbg_logger(DBG_LOGGER logger)
|
||||||
{
|
{
|
||||||
#if !defined(CONF_PLATFORM_MACOSX)
|
|
||||||
if(dbg_msg_threaded)
|
if(dbg_msg_threaded)
|
||||||
semaphore_wait(&log_queue.mutex);
|
semaphore_wait(&log_queue.mutex);
|
||||||
#endif
|
|
||||||
loggers[num_loggers] = logger;
|
loggers[num_loggers] = logger;
|
||||||
num_loggers++;
|
num_loggers++;
|
||||||
#if !defined(CONF_PLATFORM_MACOSX)
|
|
||||||
if(dbg_msg_threaded)
|
if(dbg_msg_threaded)
|
||||||
semaphore_signal(&log_queue.mutex);
|
semaphore_signal(&log_queue.mutex);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbg_logger_stdout() { dbg_logger(logger_stdout); }
|
void dbg_logger_stdout() { dbg_logger(logger_stdout); }
|
||||||
|
|
Loading…
Reference in a new issue