From 7f8dfe2fd3e770c2e0435e9c56f5db5fd11ed6f7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 31 Jan 2010 09:27:49 +0000 Subject: Implemented thread reference counters and related APIs. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1556 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/threads.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'os/kernel/include/threads.h') diff --git a/os/kernel/include/threads.h b/os/kernel/include/threads.h index f94beac32..a9209e6ea 100644 --- a/os/kernel/include/threads.h +++ b/os/kernel/include/threads.h @@ -54,6 +54,9 @@ struct Thread { /* End of the fields shared with the ThreadsQueue structure. */ tprio_t p_prio; /**< Thread priority. */ /* End of the fields shared with the ReadyList structure. */ +#if CH_USE_DYNAMIC + trefs_t p_refs; /**< References to this thread. */ +#endif tstate_t p_state; /**< Current thread state. */ tmode_t p_flags; /**< Various thread flags. */ struct context p_ctx; /**< Processor context. */ @@ -61,7 +64,7 @@ struct Thread { cnt_t p_locks; /**< Number of nested locks. */ #endif #if CH_DBG_THREADS_PROFILING - volatile systime_t p_time; /**< Thread consumed time in ticks. + volatile systime_t p_time; /**< Thread consumed time in ticks. @note This field can overflow. */ #endif union { @@ -76,7 +79,7 @@ struct Thread { #endif } p_u; /**< State-specific fields. */ #if CH_USE_WAITEXIT - Thread *p_waiting; /**< Thread waiting for termination.*/ + ThreadsList p_waiting; /**< Termination waiting list. */ #endif #if CH_USE_MESSAGES ThreadsQueue p_msgqueue; /**< Messages queue. */ @@ -167,6 +170,10 @@ extern "C" { void chThdSleepUntil(systime_t time); void chThdYield(void); void chThdExit(msg_t msg); +#if CH_USE_DYNAMIC + Thread *chThdAddRef(Thread *tp); + Thread *chThdRelease(Thread *tp); +#endif #if CH_USE_WAITEXIT msg_t chThdWait(Thread *tp); #endif -- cgit v1.2.3