X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=blobdiff_plain;f=tos%2Flib%2Ftosthreads%2Fsystem%2FStaticThreadP.nc;h=f4e1e92c07ebf6495907604f93c9be085880915f;hp=ace29d103769c7027c0a6d757d4f422c56cebe39;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hpb=adf1de6c009d13b7b52e68535c63b28f59c97400 diff --git a/tos/lib/tosthreads/system/StaticThreadP.nc b/tos/lib/tosthreads/system/StaticThreadP.nc index ace29d10..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 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) { @@ -87,6 +90,10 @@ implementation { return call ThreadSleep.sleep(milli); } + command error_t Thread.join[uint8_t id]() { + return call ThreadScheduler.joinThread(id); + } + event void ThreadFunction.signalThreadRun[uint8_t id](void *arg) { signal Thread.run[id](arg); } @@ -97,6 +104,7 @@ implementation { default event void Thread.run[uint8_t id](void* arg) {} default async command thread_t* ThreadInfo.get[uint8_t id]() {return NULL;} + default async command error_t ThreadInfo.reset[uint8_t id]() {return FAIL;} default async event void ThreadNotification.justCreated[uint8_t id]() {} default async event void ThreadNotification.aboutToDestroy[uint8_t id]() {}