interface SplitControl;
interface PowerDownCleanup;
- interface ResourceController;
+ interface ResourceDefaultOwner;
interface ArbiterInfo;
interface Timer<TMilli> as TimerMilli;
}
call TimerMilli.stop();
stopTimer = FALSE;
call StdControl.start();
- call SplitControl.start();
+ if (call SplitControl.start()==EALREADY)
+ call ResourceDefaultOwner.release();
}
task void timerTask() {
call TimerMilli.startOneShot(delay);
}
- async event void ResourceController.requested() {
+ async event void ResourceDefaultOwner.requested() {
if(stopping == FALSE) {
stopTimer = TRUE;
post startTask();
}
- else atomic requested = TRUE;
+ else requested = TRUE;
}
- async event void ResourceController.immediateRequested() {
+ async event void ResourceDefaultOwner.immediateRequested() {
}
default command error_t StdControl.start() {
}
event void SplitControl.startDone(error_t error) {
- call ResourceController.release();
+ call ResourceDefaultOwner.release();
}
- async event void ResourceController.granted() {
+ async event void ResourceDefaultOwner.granted() {
post timerTask();
}
event void TimerMilli.fired() {
- if(stopTimer == FALSE) {
- stopping = TRUE;
- call PowerDownCleanup.cleanup();
- call StdControl.stop();
- call SplitControl.stop();
+ atomic {
+ if(stopTimer == FALSE) {
+ stopping = TRUE;
+ call PowerDownCleanup.cleanup();
+ call StdControl.stop();
+ if (call SplitControl.stop()==EALREADY)
+ signal SplitControl.stopDone(SUCCESS);
+ }
}
}