Subject: Re: Kernel semaphore API
To: Andrew Doran <ad@netbsd.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 03/29/2007 08:47:10
On Mar 29, 2007, at 5:13 AM, Andrew Doran wrote:

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

Another question -- where did you get the API from?  We've been  
adopting Solaris API for synchronization primitives, and I think we  
should do the same with semaphores, if we're going to have them.   
This is not like the Solaris semaphore API.

>
> 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);

-- thorpej