#include <semaphore.h>
Collaboration diagram for Semaphore:

Public Member Functions | |
| void | init (unsigned start_value=1) |
| bool | acquire (unsigned timeout=0) |
| bool | try_acquire () |
| bool | release () |
| void | remove_task (Task *task) |
| void | print () |
Protected Attributes | |
| List< Task > | waiting_tasks |
| unsigned | value |
Acquiring a semaphore that is already acquired causes the call to block until the semaphore becomes released.
|
|
Lock this semaphore. If it's already locked, first block until it becomes unlocked and return true. An optional timeout in milliseconds can be given. If a timeout occurs before the lock is successful, return false. |
|
|
Initialize this semaphore's default value. Setting a default value higher than 1 means that the semaphore can be acquire()d multiple times before subsequent acquire() invocations block. Setting a default value of 0 means that every acquire() call to this semaphore will block. |
|
|
Print basic information about this semaphore.
|
|
|
Unlock this semaphore and wake up one thread that is waiting to acquire it. Return true if there was a thread to wake up. |
|
|
Remove a task from this semaphore's waiting task list.
|
|
|
Attempt to lock this semaphore without blocking. Return true on success or false if it is already locked. |
|
|
current value of this semaphore
|
|
|
tasks waiting for this semaphore
|
Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman