summaryrefslogtreecommitdiffstats
path: root/once.h
blob: a37452901171dfc9fbac529fb880e87c8eed32f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef foosydneyoncehfoo
#define foosydneyoncehfoo

#include "mutex.h"

typedef struct sa_once {
    unsigned int once_value;
    sa_mutex_t *mutex;
} sa_once_t;

#define SA_ONCE_INIT { .once_value = 0, .mutex = NULL }

typedef void (*sa_once_func_t) (void);

int sa_once(sa_once_t *o, sa_once_func_t f);

#endif