/* Validate nested k_sched_lock() and k_sched_unlock() 
In a preemptive thread, lock the scheduler twice and create a cooperative thread. Call k_sched_unlock() and check the cooperative thread haven't executed. Unlock it again to see the thread have executed this time. */
ZTEST(threads_scheduling, test_unlock_nested_sched_lock)
/* Validate nested k_sched_lock() and k_sched_unlock() 
In a preemptive thread, lock the scheduler twice and create a cooperative thread. Call k_sched_unlock() and check the cooperative thread haven't executed. Unlock it again to see the thread have executed this time. */
ZTEST(threads_scheduling, test_unlock_nested_sched_lock)
{
	init_prio = 0;
	setup_threads();
	k_sched_lock();
	k_sched_lock();
	spawn_threads(0);
	k_busy_wait(100000);
	k_sched_unlock();
	for (int i = 0; i < THREADS_NUM; i++) {
		zassert_true(tdata[i].executed == 0);
	}
	k_sched_unlock();
	k_yield();
	zassert_true(tdata[0].executed == 1);
	zassert_true(tdata[1].executed == 1);
	zassert_true(tdata[2].executed == 0);
	teardown_threads();
}