Interface: tos.interfaces.Resource
interface Resource
Please refer to TEP 108 for more information about this interface and its
intended use.
The Resource interface can be used to gain access to
shared resources. It is always offered as a parameterized
interface, and its users gain access to the resource through some
predefined arbitration policy.
- Author:
-
Kevin Klues (klueska@cs.wustl.edu)
- Version:
-
$Revision: 1.5 $
- Date:
-
$Date: 2007/04/15 20:05:03 $
Commands
command error_t immediateRequest()
command bool isOwner()
command error_t release()
command error_t request()
Events
event void granted()
Commands - Details
immediateRequest
command error_t immediateRequest()
- Returns:
-
SUCCESS When a request has been accepted.
FAIL The request cannot be fulfilled
isOwner
command bool isOwner()
- Returns:
-
TRUE It is the owner
FALSE It is not the owner
release
command error_t release()
- Returns:
-
SUCCESS The resource has been released
FAIL You tried to release but you are not the
owner of the resource
- Note:
-
This command should never be called between putting in a request
and waiting for a granted event. Doing so will result in a
potential race condition. There are ways to guarantee that no
race will occur, but they are clumsy and overly complicated.
Since it doesn't logically make since to be calling
release before receiving a granted event,
we have opted to keep thing simple and warn you about the potential
race.
request
command error_t request()
- Returns:
-
SUCCESS When a request has been accepted. The granted()
event will be signaled once you have control of the
resource.
EBUSY You have already requested this resource and a
granted event is pending
Events - Details
granted
event void granted()