Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
bmptk::rtos::waitable Class Reference

abstract thing that a task can wait for More...

#include <rtos.h>

Inheritance diagram for bmptk::rtos::waitable:
bmptk::rtos::event bmptk::rtos::flag

Public Member Functions

virtual void clear ()
 clear the waitable
 
- Public Member Functions inherited from bmptk::rtos::event
void print (std::ostream &s, bool header) const
 prints an event, for debugging only
 
bool operator== (const event &rhs) const
 report wether two events are the same
 
bool operator== (const waitable &rhs) const
 report whether an event corresponds to a waitable
 
bool operator!= (const event &rhs) const
 report wether two events are not the same
 
bool operator!= (const waitable &rhs) const
 report whether an event does not correspond to a waitable
 
event operator+ (const event &rhs) const
 add two waitables, result can be used in a wait() call
 

Protected Member Functions

 waitable (task *task, const char *name)
 constructor, specify owner and name
 
void set ()
 set the waitable
 

Friends

class waitable_set
 

Detailed Description

abstract thing that a task can wait for

Waitable is an abstract class (there are no objects that are just a waitable). flag, timer, clock and channel are concrete classes that inherit from waitable. A waitable is always created for a particular task. A maximum of 31 waitables can be created for each task. (Actually the maximum is 32, but one waitable is created internally to implement the rtos-version of the wait() call.) A waitable can be two states: set or cleared. A waitable is initially cleared.

A task can wait for one, a subset, or all waitables created for it. The default is to wait for all waitables created for the task, the other variants are specified by supplying to the task:wait() call either a single waitable, or the sum (operator+) of the waitables you want to wait for. When one of the waitables that is waited for is or becomes set the wait() call clears that waitable and returns an event that compares equal to the waitable. (Note that some waitables, for instance the channel, can immediately set itself again.) The calling task can compare that event to the waitables to see which event happened. When more than one of the waited-for waitables is set the wait() call makes an arbitrary choice from these waitables.

The operation clear() is provided (virtual, the default only clears the waitable) set() is provided but private (not all waitables can be set by the user).

Definition at line 218 of file rtos.h.

Constructor & Destructor Documentation

bmptk::rtos::waitable::waitable ( task task,
const char *  name 
)
protected

constructor, specify owner and name

The name is used for debugging only.

Member Function Documentation

virtual void bmptk::rtos::waitable::clear ( )
virtual

clear the waitable

This is automatically done when the waitable causes a task::wait() call to return it.


The documentation for this class was generated from the following file: