diff --git a/os/rt/src/chthreads.c b/os/rt/src/chthreads.c index 04b8fab4c..f432aab1e 100644 --- a/os/rt/src/chthreads.c +++ b/os/rt/src/chthreads.c @@ -216,6 +216,11 @@ thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp) { thread_t *chThdCreateSuspended(const thread_descriptor_t *tdp) { thread_t *tp; +#if CH_CFG_USE_REGISTRY == TRUE + chDbgAssert(chRegFindThreadByWorkingArea(tdp->wbase) == NULL, + "working area in use"); +#endif + #if CH_DBG_FILL_THREADS == TRUE _thread_memfill((uint8_t *)tdp->wbase, (uint8_t *)tdp->wend, @@ -275,6 +280,11 @@ thread_t *chThdCreateI(const thread_descriptor_t *tdp) { thread_t *chThdCreate(const thread_descriptor_t *tdp) { thread_t *tp; +#if CH_CFG_USE_REGISTRY == TRUE + chDbgAssert(chRegFindThreadByWorkingArea(tdp->wbase) == NULL, + "working area in use"); +#endif + #if CH_DBG_FILL_THREADS == TRUE _thread_memfill((uint8_t *)tdp->wbase, (uint8_t *)tdp->wend, @@ -319,6 +329,11 @@ thread_t *chThdCreateStatic(void *wsp, size_t size, MEM_IS_ALIGNED(size, PORT_STACK_ALIGN) && (prio <= HIGHPRIO) && (pf != NULL)); +#if CH_CFG_USE_REGISTRY == TRUE + chDbgAssert(chRegFindThreadByWorkingArea(wsp) == NULL, + "working area in use"); +#endif + #if CH_DBG_FILL_THREADS == TRUE _thread_memfill((uint8_t *)wsp, (uint8_t *)wsp + size, diff --git a/test/rt/testbmk.c b/test/rt/testbmk.c index 1bffbc4df..3cc713089 100644 --- a/test/rt/testbmk.c +++ b/test/rt/testbmk.c @@ -312,7 +312,11 @@ static void bmk6_execute(void) { test_wait_tick(); test_start_timer(1000); do { +#if CH_CFG_USE_REGISTRY + chThdRelease(chThdCreateStatic(wap, WA_SIZE, prio, thread1, NULL)); +#else chThdCreateStatic(wap, WA_SIZE, prio, thread1, NULL); +#endif n++; #if defined(SIMULATOR) _sim_check_for_interrupts();