COSA
An Object-Oriented Platform for Arduino Programming
Resource Class Referenceabstract

#include <Resource.hh>

Collaboration diagram for Resource:
Collaboration graph

Public Member Functions

 Resource ()
 
void acquire ()
 
bool try_acquire ()
 
void release ()
 

Protected Member Functions

virtual void on_acquire ()=0
 
virtual void on_release ()=0
 

Detailed Description

Abstract Resource Handler. Secure acquire and release of resources.

Definition at line 29 of file Resource.hh.

Constructor & Destructor Documentation

Resource::Resource ( )
inline

Construct Resource Handler.

Definition at line 34 of file Resource.hh.

Member Function Documentation

void Resource::acquire ( )
inline

Acquire the resource. Wait until the resource is not busy. Mark as busy and call on_acquire() in synchronized context.

Definition at line 42 of file Resource.hh.

virtual void Resource::on_acquire ( )
protectedpure virtual

Resource extension on acquire.

virtual void Resource::on_release ( )
protectedpure virtual

Resource extension on release.

void Resource::release ( )
inline

Release the resource. Call on_release() in synchronized context and mark the resource as available.

Definition at line 67 of file Resource.hh.

bool Resource::try_acquire ( )
inline

Try to acquire the resource. If successful, mark as busy and call on_acquire() in synchronized context.

Returns
bool.

Definition at line 54 of file Resource.hh.


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