From 6d6284c9e6d1e3d1f0083c153ee21235771e1014 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 24 Feb 2016 14:44:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8941 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/rt/include/chdynamic.h | 4 ++-- os/rt/include/chevents.h | 8 -------- os/rt/include/chthreads.h | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'os/rt/include') diff --git a/os/rt/include/chdynamic.h b/os/rt/include/chdynamic.h index fa42bf3ae..9b653cc5c 100644 --- a/os/rt/include/chdynamic.h +++ b/os/rt/include/chdynamic.h @@ -71,16 +71,16 @@ #ifdef __cplusplus extern "C" { #endif + thread_t *chThdAddRef(thread_t *tp); + void chThdRelease(thread_t *tp); #if CH_CFG_USE_HEAP == TRUE thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size, const char *name, tprio_t prio, tfunc_t pf, void *arg); - void chThdFreeToHeap(thread_t *tp); #endif #if CH_CFG_USE_MEMPOOLS == TRUE thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, const char *name, tprio_t prio, tfunc_t pf, void *arg); - void chThdFreeToMemoryPool(thread_t *tp, memory_pool_t *mp); #endif #ifdef __cplusplus } diff --git a/os/rt/include/chevents.h b/os/rt/include/chevents.h index fa8e4d7a5..8432eea8e 100644 --- a/os/rt/include/chevents.h +++ b/os/rt/include/chevents.h @@ -37,14 +37,6 @@ /* Module constants. */ /*===========================================================================*/ -/** - * @brief Event bit reserved for thread termination request. - * @note The most significant bit of the events mask is conventionally - * used for thread termination but it can eventually be used for - * other events. - */ -#define CH_EVENT_TERMINATE ~(((eventmask_t)-1) >> 1U) - /*===========================================================================*/ /* Module pre-compile time settings. */ /*===========================================================================*/ diff --git a/os/rt/include/chthreads.h b/os/rt/include/chthreads.h index 8d632d59e..d4f2a68d0 100644 --- a/os/rt/include/chthreads.h +++ b/os/rt/include/chthreads.h @@ -182,6 +182,7 @@ extern "C" { tprio_t prio, tfunc_t pf, void *arg); thread_t *chThdStart(thread_t *tp); tprio_t chThdSetPriority(tprio_t newprio); + void chThdTerminate(thread_t *tp); msg_t chThdSuspendS(thread_reference_t *trp); msg_t chThdSuspendTimeoutS(thread_reference_t *trp, systime_t timeout); void chThdResumeI(thread_reference_t *trp, msg_t msg); @@ -276,6 +277,19 @@ static inline bool chThdTerminatedX(thread_t *tp) { return (bool)(tp->state == CH_STATE_FINAL); } +/** + * @brief Verifies if the current thread has a termination request pending. + * + * @retval true termination request pending. + * @retval false termination request not pending. + * + * @xclass + */ +static inline bool chThdShouldTerminateX(void) { + + return (bool)((chThdGetSelfX()->flags & CH_FLAG_TERMINATE) != (tmode_t)0); +} + /** * @brief Resumes a thread created with @p chThdCreateI(). * -- cgit v1.2.3