Subject: Kernel semaphore API
To: None <tech-kern@netbsd.org>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 03/29/2007 13:13:12
Hi,

Here's an API for counting semaphores in the kernel. It's similar to what we
have now for condition variables.

Any comments?

Thanks,
Andrew

void    sema_init(ksema_t *sem, const char *wmesg, u_int value);
void    sema_destroy(ksema_t *sem);

void    sema_wait(ksema_t *sem);
int     sema_wait_sig(ksema_t *sem);
int     sema_timedwait(ksema_t *sem, u_int ticks);
int     sema_timedwait_sig(ksema_t *sem, u_int ticks);

bool    sema_try(ksema_t *sem);

void    sema_post(ksema_t *sem);