resource.h File Reference

TODO: More...

#include <drv/timer.h>
#include <kern/sem.h>

Go to the source code of this file.

Data Structures

struct  Resource
 Hold context information for a resource such as an audio channel. More...

Typedefs

typedef struct Resource Resource
 Hold context information for a resource such as an audio channel.

Enumerations

enum  
 

Event sent by ResMan to owners when to request resource release.


Functions

bool ResMan_Alloc (Resource *res, int pri, ResMan_time_t timeout, struct Observer *releaseRequest)
 Try to allocate a resource res with priority pri for at most timeout ticks.
void ResMan_Free (Resource *res)
 Free resource res. Will eventually wake-up other queued owners.

Detailed Description

TODO:

Version:
Id
resource.h 2506 2009-04-15 08:29:07Z duplo
Author:
Bernie Innocenti <bernie@codewiz.org>
Stefano Fedrigo <aleph@develer.com>

Definition in file resource.h.


Typedef Documentation

typedef struct Resource 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.