Skip to content

File SolidSyslogAtomicCounter.h

FileList > Core > Interface > SolidSyslogAtomicCounter.h

Go to the source code of this file

The atomic-counter role: hand out the next sequenceId (Increment), wrap-aware over [1, 2^31 - 1] and never 0 per RFC 5424 §7.3.1. More...

  • #include "ExternC.h"
  • #include <stdint.h>

Public Types

Type Name
enum @0

Public Functions

Type Name
uint32_t SolidSyslogAtomicCounter_Increment (struct SolidSyslogAtomicCounter * base)
Advance the counter and return its new value.

Detailed Description

This call dispatches to the injected counter's vtable, so behaviour is that counter's.

Public Types Documentation

enum @0

enum @0 {
    SOLIDSYSLOG_SEQUENCE_ID_MAX =
            2147483647U
};

Public Functions Documentation

function SolidSyslogAtomicCounter_Increment

Advance the counter and return its new value.

uint32_t SolidSyslogAtomicCounter_Increment (
    struct SolidSyslogAtomicCounter * base
) 

Thread-safe: concurrent callers each get a distinct value across the [1, SOLIDSYSLOG_SEQUENCE_ID_MAX] cycle, so it can serve as the sequenceId of every message on a shared logger. The value is never 0 (RFC 5424 §7.3.1), so a returned 1 is ambiguous: it means either the first increment after power-on or the wrap past the maximum, and a reader cannot tell the two apart.



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