libklvanc
 All Classes Files Functions Variables Enumerations Macros
Classes
klrestricted_code_path.h File Reference

Generic code to limit the running of certain code to N times per second. Primary use case is to prevent errors from spamming system logs. User allocates a small context, context contains max latency.__msfr_align Users asks whether its permitted to execute the code block, function determines answer. First occurence is always allowed to execute. More...

#include <stdint.h>
#include <string.h>
#include <sys/time.h>

Go to the source code of this file.

Classes

struct  klrestricted_code_path_block_s
 

Detailed Description

Generic code to limit the running of certain code to N times per second. Primary use case is to prevent errors from spamming system logs. User allocates a small context, context contains max latency.__msfr_align Users asks whether its permitted to execute the code block, function determines answer. First occurence is always allowed to execute.

Author
Steven Toth stoth.nosp@m.@ker.nosp@m.nella.nosp@m.bs.c.nosp@m.om

USAGE during runtime: if (klrestricted_code_path_block_execute(&global_mypathXYZ)) { fprintf(stderr, "I logged a high volume message, but only once per second!\n"); }