kernel: thread: make offload_sem visible for releasing it outside

In order to release irq_offload semaphore outside kernel/thread.c, we
make it visible by modifying it non-static under ztest. This would be
needed such as when call irq_offload() to enter interrupt context and
a fatal error happened, then you have to release it in your fatal
handler, or the irq_offload will still be locked and no longer be
using again.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
This commit is contained in:
Enjia Mai 2020-12-09 11:08:34 +08:00 committed by Anas Nashif
commit 00d7f2cfb6

View file

@ -908,7 +908,10 @@ static inline int z_vrfy_k_float_disable(struct k_thread *thread)
#endif /* CONFIG_USERSPACE */
#ifdef CONFIG_IRQ_OFFLOAD
static K_SEM_DEFINE(offload_sem, 1, 1);
/* Make offload_sem visible outside under testing, in order to release
* it outside when error happened.
*/
K_SEM_DEFINE(offload_sem, 1, 1);
void irq_offload(irq_offload_routine_t routine, const void *parameter)
{