From dab673bc2cbf4072f8a3cb0e57e5a1efd93e0324 Mon Sep 17 00:00:00 2001 From: liang_mike Date: Tue, 6 Jan 2009 00:29:04 +0000 Subject: [PATCH] Fix a static thread problem on MicaZ by making sure the execution order of ThreadInfo.reset[id]() and ThreadScheduler.initThread(id) --- tos/lib/tosthreads/system/StaticThreadP.nc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tos/lib/tosthreads/system/StaticThreadP.nc b/tos/lib/tosthreads/system/StaticThreadP.nc index 8b10acbc..f4e1e92c 100644 --- a/tos/lib/tosthreads/system/StaticThreadP.nc +++ b/tos/lib/tosthreads/system/StaticThreadP.nc @@ -50,11 +50,14 @@ module StaticThreadP { implementation { error_t init(uint8_t id, void* arg) { + error_t r1, r2; thread_t* thread_info = call ThreadInfo.get[id](); thread_info->start_arg_ptr = arg; thread_info->mutex_count = 0; thread_info->next_thread = NULL; - return ecombine(call ThreadInfo.reset[id](), call ThreadScheduler.initThread(id)); + r1 = call ThreadInfo.reset[id](); + r2 = call ThreadScheduler.initThread(id); + return ecombine(r1, r2); } command error_t Thread.start[uint8_t id](void* arg) { -- 2.39.2