📚 The CoCalc Library - books, templates and other resources
1/* Example code for Think OS. 2 3Copyright 2015 Allen Downey 4License: Creative Commons Attribution-ShareAlike 3.0 5 6*/ 7 8typedef struct { 9 int value, wakeups; 10 Mutex *mutex; 11 Cond *cond; 12} Semaphore; 13 14Semaphore *make_semaphore(int value); 15void semaphore_wait(Semaphore *semaphore); 16void semaphore_signal(Semaphore *semaphore); 17 18