From 5c4f07dcf04951e3b003e0d7d4b6eea5496f3a0d Mon Sep 17 00:00:00 2001 From: fros4943 Date: Mon, 9 Oct 2006 14:13:42 +0000 Subject: [PATCH] changed to explicit no yield allowed flag --- platform/cooja/lib/simEnvChange.c | 4 ++-- platform/cooja/lib/simEnvChange.h | 4 ++-- tools/cooja/config/code_main_template | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/platform/cooja/lib/simEnvChange.c b/platform/cooja/lib/simEnvChange.c index d13e208a4..259b01d1f 100644 --- a/platform/cooja/lib/simEnvChange.c +++ b/platform/cooja/lib/simEnvChange.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: simEnvChange.c,v 1.4 2006/10/06 10:47:09 fros4943 Exp $ + * $Id: simEnvChange.c,v 1.5 2006/10/09 14:13:42 fros4943 Exp $ */ #include @@ -38,7 +38,7 @@ extern const struct simInterface *simInterfaces[]; char simDontFallAsleep = 0; -char simInsideProcessRun = 0; +char simNoYield = 0; int simProcessRunValue; int simEtimerPending; diff --git a/platform/cooja/lib/simEnvChange.h b/platform/cooja/lib/simEnvChange.h index 2461609d5..91c0cfb48 100644 --- a/platform/cooja/lib/simEnvChange.h +++ b/platform/cooja/lib/simEnvChange.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: simEnvChange.h,v 1.4 2006/10/06 10:47:09 fros4943 Exp $ + * $Id: simEnvChange.h,v 1.5 2006/10/09 14:13:42 fros4943 Exp $ */ #ifndef __SIMENVCHANGE_H__ @@ -45,7 +45,7 @@ extern int simNextExpirationTime; // Variable that when set to != 0, stops the mote from falling asleep next tick extern char simDontFallAsleep; -extern char simInsideProcessRun; +extern char simNoYield; // Definition for registering an interface #define SIM_INTERFACE(name, doActionsBeforeTick, doActionsAfterTick) \ diff --git a/tools/cooja/config/code_main_template b/tools/cooja/config/code_main_template index 968f12f8d..122deabf3 100644 --- a/tools/cooja/config/code_main_template +++ b/tools/cooja/config/code_main_template @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: code_main_template,v 1.8 2006/10/06 10:47:33 fros4943 Exp $ + * $Id: code_main_template,v 1.9 2006/10/09 14:14:18 fros4943 Exp $ */ /** @@ -116,9 +116,7 @@ start_process_run_loop(void *data) /* Always pretend we have processes left while inside process_run() */ simProcessRunValue = 1; - simInsideProcessRun = 1; simProcessRunValue = process_run(); - simInsideProcessRun = 0; // Check if we must stay awake if (simDontFallAsleep) { @@ -231,7 +229,9 @@ JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_[CLASS_NAME]_tick(JNIEnv *env, jobject obj) { /* Let all simulation interfaces act first */ + simNoYield = 1; doActionsBeforeTick(); + simNoYield = 0; /* Check if any e-timers are pending (save result for state decisions) */ if (etimer_pending()) { @@ -247,7 +247,9 @@ Java_se_sics_cooja_corecomm_[CLASS_NAME]_tick(JNIEnv *env, jobject obj) cooja_mt_exec(&process_run_thread); /* Let all simulation interfaces act before returning to java */ + simNoYield = 1; doActionsAfterTick(); + simNoYield = 0; /* Look for new e-timers */ if (!simEtimerPending && etimer_pending()) {