Skip to content

File SolidSyslogSharedScratch.h

FileList > Core > Interface > SolidSyslogSharedScratch.h

  • #include "SolidSyslogExternC.h"

Detailed Description

The shared scratch: SolidSyslog_Log formats every message in one static buffer of SOLIDSYSLOG_MAX_MESSAGE_SIZE, taken under the injected mutex, so the buffer costs RAM once rather than once on the stack of every task that logs.

A task that logs blocks until the buffer is free.

Formatting, the header-field callbacks, any structured-data callbacks and the buffer write all run while the mutex is held. The mutex is therefore not reentrant: a callback or error handler that calls SolidSyslog_Log on the same logger deadlocks, and it must not be the mutex the Buffer takes, because that one is taken inside it.

Public Functions Documentation

SolidSyslogSharedScratch_Create

Take a pool slot holding one message buffer, guarded by mutex , which must outlive it.

struct SolidSyslogScratch * SolidSyslogSharedScratch_Create (
    struct SolidSyslogMutex * mutex
) 

The pool holds SOLIDSYSLOG_POOL_SIZE: one per logger the build can hold. The mutex is one of its own, beside any the Buffer takes, so SOLIDSYSLOG_MUTEX_POOL_SIZE must hold both. A NULL mutex, or an exhausted pool, is reported and the stack scratch is returned instead, so logging continues but on the stack of each task that logs.


SolidSyslogSharedScratch_Destroy

Release the pool slot; does not destroy the injected mutex.

void SolidSyslogSharedScratch_Destroy (
    struct SolidSyslogScratch * base
) 



The documentation for this class was generated from the following file Core/Interface/SolidSyslogSharedScratch.h