github.com/schwarzm/garden-linux@v0.0.0-20150507151835-33bca2147c47/old/linux_backend/src/wsh/barrier.h (about) 1 #ifndef BARRIER_H 2 #define BARRIER_H 1 3 4 /* 5 * This type implements a barrier-like primitive on top of a pipe. 6 * 7 * It is intended to be used by processes in need of ridiculously simple 8 * synchronization. Either process can only wait for the other process, or let 9 * the other process know it can continue. Because a pipe is used, either 10 * process will be notified by the OS when the other process dies. 11 */ 12 13 typedef struct barrier_s barrier_t; 14 15 struct barrier_s { 16 int fd[2]; 17 }; 18 19 int barrier_open(barrier_t *bar); 20 void barrier_close(barrier_t *bar); 21 void barrier_mix_cloexec(barrier_t *bar); 22 23 void barrier_close_wait(barrier_t *bar); 24 void barrier_close_signal(barrier_t *bar); 25 26 int barrier_wait(barrier_t *bar); 27 int barrier_signal(barrier_t *bar); 28 29 #endif