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

> What's your planned usage of this API?

Someone asked about the facility and we don't have it available. It's 244
lines of code including comments (which are about 1/2 the # lines).

> Another question -- where did you get the API from?

I based it around what we have for condition variables now.

> 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.

I had a look at the Solaris API and I don't like it because I've no
interest in remembering which of sema_p() and sema_v() do what. :)
It looks like there is a fairly direct mapping between the Solaris
ops and these, using #define to provide compatibility. The type has
the same name, ksema_t.

Andrew