thread-safe and fully buffered logging
Uses own thread to actually write to logs, so the main thread can't be
blocked by a slow logfile. Log entries are buffered in two ringbuffers,
one for the main thread and one for all other threads. The main thread
will copy the second buffer to the main buffer periodically. The main
thread buffer is read from the log worker thread.
Since two buffers are kept, there are now several functions to add a log
entry:
mlog()
for main thread functions only: will never block
tlog()
other threads only: may block, until main thread copied some entries
xlog()
automatically determines, which thread it's been called from and
then writes to the proper buffer (will block accordingly)
To avoid improper usage, mlog and tlog verify, if they are used correctly.
(Only for debug builds. An assert triggers, if necessary.)
This commit is contained in:
+1
-1
@@ -58,7 +58,7 @@ extern float waterlevel;
|
||||
#define AC_VERSION 1202
|
||||
#define AC_MASTER_URI "ms.cubers.net"
|
||||
#define AC_MASTER_PORT 28760
|
||||
#define MAXCL 16
|
||||
#define MAXCLIENTSONMASTER 16 // FIXME
|
||||
#define CONFIGROTATEMAX 5 // keep 5 old versions of saved.cfg and init.cfg around
|
||||
|
||||
#define DEFAULT_FOG 180
|
||||
|
||||
Reference in New Issue
Block a user