ApparatusFramework::Semaphore Class Reference
[Kernel Services]

#include <KernelServices/Win32/current/include/Semaphore.h>

List of all members.

Public Member Functions

 Semaphore (const uint8 initialValue)
 Semaphore (const Semaphore &lvalue)
 ~Semaphore ()
Semaphoreoperator= (const Semaphore &lvalue)
void get ()
bool get (const Timeout timeoutInMilliseconds)
void put ()

Detailed Description

The semaphore class implements the semaphore concept as described in the seminal work from O'Hoare. This class is a mixin class.

Definition at line 55 of file Semaphore.h.


Constructor & Destructor Documentation

ApparatusFramework::Semaphore::Semaphore ( const uint8  initialValue  )  [explicit]

constructors, destructors Constructs a new semaphore object with the given initial value.

Parameters:
initialValue initial credit of the counting semaphore.
ApparatusFramework::Semaphore::Semaphore ( const Semaphore lvalue  ) 

The copy constructor constructs a new semaphore object.

Parameters:
lvalue semaphore used to generate a new object.
ApparatusFramework::Semaphore::~Semaphore (  ) 

Destroys a semaphore object and releases all the associated ressources.


Member Function Documentation

bool ApparatusFramework::Semaphore::get ( const Timeout  timeoutInMilliseconds  ) 

Decrements the value of the counter by one. If the value is negative suspend the calling task.

Parameters:
timeoutInMilliseconds maximum timeout in milliseconds. Time precision depends on the OS. E.g. Win32 1ms, eCos 10ms
Returns:
bool true if the semaphore could be aquired, false if the timeout expired.
Postcondition:
(m_value == m_value' - 1) && ((m_value < 0) && task.suspended())
void ApparatusFramework::Semaphore::get (  ) 

modifiers Decrements the value of the counter by one. If the value is negative suspend the calling task.

Postcondition:
(m_value == m_value' - 1) && ((m_value < 0)&&task.suspended())
Semaphore& ApparatusFramework::Semaphore::operator= ( const Semaphore lvalue  ) 

operators The copy operator constructs a new semaphore object.

Parameters:
lvalue semaphore object to be copied.
Returns:
Semaphore copied object.
void ApparatusFramework::Semaphore::put (  ) 

Increments the value of the counter by one. If the value is positive and at least one task is pending, wakes up the longest waiting task.

Postcondition:
(m_value == m_value' + 1) && (((m_value >= 0) && (queue.notEmpty)) && queue'.start.isReady())
© 2004-2010 bbv Software Services AG / Apparatus Services