Subject: Re: semaphore
To: None <darrenr@reed.wattle.id.au>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-kern
Date: 03/22/2002 09:40:11
> How about adding:
> 
> #define	sema_v(x)	sema_signal(x)
> #define	sema_p(x)	sema_spinwait(x)
> #define	sema_p_wait(x)	sema_wait(x)
> 
> just to make it easier...

Would that make it easier or just cause confusion?
Also I'm not sure that sema_p should not be sema_wait

> I'm not sure I understand the "n" mutation here...

The "n" mutation is for things like:

sema_wait_n(x, 10)

which will block until the semaphore can be decremented by 10,
effectively allocating 10 resource units in an atomic fashion.
sema_signal_n(x, 10) allows the release of 10 units in one operation 
increasing the likelyhood that someone wanting to take multiple
units can succeed.

--sjg