BeRTOS
|
Hold context information for a resource such as an audio channel. More...
#include <resource.h>
Data Fields | |
Semaphore | lock |
Control access to fields below. | |
struct Observer * | owner |
Pointer to current owner's observer. NULL if resource is free. | |
int | pri |
Priority of current owner (higher values mean higher priority). | |
List | queue |
Queue of processes waiting to obtain the resource. |
Hold context information for a resource such as an audio channel.
Each driver registers one or more Resource instances with the ResMan using ResMan_Register().
Clients can then allocate the resource through ResMan_Alloc() providing a desired priority and an Observer for asynchronous notification.
Allocated resources can be stolen by other clients asking for a higher priority. ResMan notifies a preemption request by invoking the Observer of the current owner.
The Observer callback must take whatever action is needed to release the resource as soon as possible to avoid blocking the new owner.
Definition at line 78 of file resource.h.