static void tcoop_ctx(void *p1, void *p2, void *p3) { /** TESTPOINT: The thread's priority is in the cooperative range.*/ zassert_false(k_is_preempt_thread(), NULL); k_thread_priority_set(k_current_get(), K_PRIO_PREEMPT(1)); /** TESTPOINT: The thread's priority is in the preemptible range.*/ zassert_true(k_is_preempt_thread(), NULL); k_sched_lock(); /** TESTPOINT: The thread has locked the scheduler.*/ zassert_false(k_is_preempt_thread(), NULL); k_sched_unlock(); /** TESTPOINT: The thread has not locked the scheduler.*/ zassert_true(k_is_preempt_thread(), NULL); k_sem_give(&end_sema); }
STATIC mp_obj_t mod_is_preempt_thread(void) { return mp_obj_new_bool(k_is_preempt_thread()); }
static void tIsr(void *data) { /** TESTPOINT: The code is running at ISR.*/ zassert_false(k_is_preempt_thread(), NULL); }