Semaphore initialization You can declare and initialize a semaphore with: #include struct semaphore sem; void sema_init(struct semaphore *sem, int value); The usual technique, however, is: DECLARE_MUTEX(name); DECLARE_MUTEX_LOCKED(name); Or, at run time: void init_MUTEX(struct semaphore *sem); void init_MUTEX_LOCKED(struct semaphore *sem);