Concord - C Discord API library
A Discord API wrapper library written in C
concord-once.h File Reference

Initialized once. More...

#include "concord-error.h"
Include dependency graph for concord-once.h:

Go to the source code of this file.

Typedefs

typedef CCORDcode(* ccord_once_cb) (long flags)
 

Functions

CCORDcode ccord_once_set_callback (ccord_once_cb callback, long flags)
 Register a user callback for initialization. More...
 
CCORDcode ccord_once (_Bool *once)
 Initialize context once. More...
 
void ccord_once_cleanup (void)
 Cleanup once context. More...
 

Detailed Description

Initialized once.

Author
Cogmasters

Typedef Documentation

◆ ccord_once_cb

typedef CCORDcode(* ccord_once_cb) (long flags)

Callback function type for user initialization

Function Documentation

◆ ccord_once_set_callback()

CCORDcode ccord_once_set_callback ( ccord_once_cb  callback,
long  flags 
)

Register a user callback for initialization.

This callback will be executed exactly once during initialization after all internal initializations have been performed. Multiple callbacks can be registered from different modules, and they will be executed in the order they were registered.

Parameters
callbackThe function to call during initialization
flagsFlag to pass to the callback, that will be passed to the callback function
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ ccord_once()

CCORDcode ccord_once ( _Bool *  once)

Initialize context once.

Parameters
oncePointer to a static boolean flag that will be set to true if the initialization was successful. This flag should be used to ensure that the initialization is only performed once.
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ ccord_once_cleanup()

void ccord_once_cleanup ( void  )

Cleanup once context.

This function will be called to cleanup the once context. It will be called when the program is exiting, and it will cleanup all registered callbacks.