CS代考计算机代写 #ifndef SEMAPHORE_H
#ifndef SEMAPHORE_H
#define SEMAPHORE_H
#include
/* Semaphore */
struct semaphore {
unsigned value; /* Current value */
struct list waiters; /* List of waiting threads */
struct list_elem elem; /* condvar waiters list elem */
};
void semaphore_init(struct semaphore *, unsigned value);
void semaphore_down(struct semaphore *);
bool semaphore_try_down(struct semaphore *);
void semaphore_up(struct semaphore *);
void semaphore_self_test(void);
#endif /* UCSC CSE130 */