[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Semaphore description in UM
- Date: Thu, 27 Dec 2007 09:47:23 -0600
- From: joel.sherrill at oarcorp.com (Joel Sherrill)
- Subject: Semaphore description in UM
Leon Pollak wrote:
> Hello, all.
> With great shame I must admit that I am lost (may be the problem of my
> English?). I passed through the manual for something and saw the para 9.4.5
> (rtems_semaphore_release) stating the following:
> This directive releases the semaphore specified by id. The semaphore count is
> incremented by one. If the count is zero or negative, then the first task on
> this semaphore's wait queue is removed and unblocked.
> Does this mean that if the count is greater then zero, then nothing happens?
> Or/and does this mean that simply each release call makes the waiting task
> ready, but if there was no waiting task the next obtain request will block?
It means that if there are no threads blocked, the count is adjusted.
If there are threads blocked, the count isn't touched. The semaphore
is logically transferred to the other thread.
> And here is the question I was looking for: is there any way to know the
> counting semaphore value via the API?
Not at the current time. It isn't hard to implement but
we are slowly heading toward having "info" services
for each manager where you could get all this and more.
But it should be easy to implement if you want it.
> Thanks a lot ahead and my apologizes for so not understanding...
No the English probably isn't as clear as it could be.