Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

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