X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=blobdiff_plain;f=tos%2Flib%2Fpower%2FDeferredPowerManagerP.nc;h=209b5ffcbad38767825644d862454b77ac431a87;hp=250042cee03e3ff41a48bc5126890d4c8619c033;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hpb=adf1de6c009d13b7b52e68535c63b28f59c97400 diff --git a/tos/lib/power/DeferredPowerManagerP.nc b/tos/lib/power/DeferredPowerManagerP.nc index 250042ce..209b5ffc 100644 --- a/tos/lib/power/DeferredPowerManagerP.nc +++ b/tos/lib/power/DeferredPowerManagerP.nc @@ -70,7 +70,8 @@ implementation { call TimerMilli.stop(); stopTimer = FALSE; call StdControl.start(); - call SplitControl.start(); + if (call SplitControl.start()==EALREADY) + call ResourceDefaultOwner.release(); } task void timerTask() { @@ -82,7 +83,7 @@ implementation { stopTimer = TRUE; post startTask(); } - else atomic requested = TRUE; + else requested = TRUE; } async event void ResourceDefaultOwner.immediateRequested() { @@ -105,11 +106,14 @@ implementation { } 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); + } } }