From 992a715ba60ce2a4358cbe068d89ac72deb51e65 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 23 Aug 2007 07:36:34 +0000 Subject: [PATCH] moved init routines to be executed on node specific basis --- tools/cooja/config/contiki_template.c | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/cooja/config/contiki_template.c b/tools/cooja/config/contiki_template.c index 3e11ae036..72966e9aa 100644 --- a/tools/cooja/config/contiki_template.c +++ b/tools/cooja/config/contiki_template.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: contiki_template.c,v 1.4 2007/08/21 13:10:19 fros4943 Exp $ + * $Id: contiki_template.c,v 1.5 2007/08/23 07:36:34 fros4943 Exp $ */ /** @@ -106,7 +106,22 @@ static struct cooja_mt_thread process_run_thread; static void start_process_run_loop(void *data) { - while(1) + /* Initialize random generator */ + random_init(0); + + /* Start process handler */ + process_init(); + + /* Start Contiki processes */ + procinit_init(); + + /* Initialize communication stack */ + init_net(); + + /* Start user applications */ + autostart_start((struct process **) autostart_processes); + + while(1) { /* Always pretend we have processes left while inside process_run() */ simProcessRunValue = 1; @@ -144,21 +159,6 @@ extern unsigned long _end; JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_[CLASS_NAME]_init(JNIEnv *env, jobject obj) { - /* Initialize random generator */ - random_init(0); - - /* Start process handler */ - process_init(); - - /* Start Contiki processes */ - procinit_init(); - - /* Initialize communication stack */ - init_net(); - - /* Start user applications */ - autostart_start((struct process **) autostart_processes); - /* Prepare thread that will do the process_run()-loop */ cooja_mt_start(&process_run_thread, &start_process_run_loop, NULL); }