24 lines
385 B
C
24 lines
385 B
C
|
|
#ifndef WAITGROUP_H_QWERTY
|
|
#define WAITGROUP_H_QWERTY
|
|
|
|
#include <semaphore.h>
|
|
#include <pthread.h>
|
|
#include <stdatomic.h>
|
|
#include <stdio.h>
|
|
|
|
typedef struct {
|
|
sem_t sem;
|
|
atomic_int num;
|
|
} wg_t;
|
|
|
|
wg_t* new_gw(void);
|
|
void wg_init(wg_t* wg);
|
|
void wg_add(wg_t* wg);
|
|
void wg_done(wg_t* wg);
|
|
void wg_wait(wg_t* wg);
|
|
void wg_destroy(wg_t* wg);
|
|
void wg_free(wg_t* wg);
|
|
|
|
#endif
|