Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
test_sched_timeslice_and_lock.c File Reference
#include "test_sched.h"

Macros

#define THREADS_NUM   3
 
#define DURATION   K_MSEC(1)
 

Functions

 K_SEM_DEFINE (pend_sema, 0, 1)
 
 K_SEM_DEFINE (timer_sema, 0, 1)
 
static void thread_entry (void *p1, void *p2, void *p3)
 
static void setup_threads (void)
 
static void spawn_threads (int sleep_sec)
 
static void teardown_threads (void)
 
static void timer_handler (struct k_timer *timer)
 
static void thread_handler (void *p1, void *p2, void *p3)
 
 ZTEST (threads_scheduling, test_yield_cooperative)
 Validate the behavior of cooperative thread when it yields.
 
 ZTEST (threads_scheduling, test_sleep_cooperative)
 Validate the behavior of cooperative thread when it sleeps.
 
 ZTEST (threads_scheduling, test_busy_wait_cooperative)
 
 ZTEST (threads_scheduling, test_sleep_wakeup_preemptible)
 Validate k_wakeup()
 
static void coop_thread (void *p1, void *p2, void *p3)
 
 ZTEST (threads_scheduling, test_pending_thread_wakeup)
 Verify k_wakeup() behavior on pending thread.
 
 ZTEST (threads_scheduling, test_time_slicing_preemptible)
 Validate preemptive thread behavior with time slice.
 
 ZTEST (threads_scheduling, test_time_slicing_disable_preemptible)
 Check the behavior of preemptive thread with k_busy_wait()
 
 ZTEST (threads_scheduling, test_lock_preemptible)
 Lock the scheduler when preemptive threads are running.
 
 ZTEST (threads_scheduling, test_unlock_preemptible)
 Validate k_sched_lock() and k_sched_unlock()
 
 ZTEST (threads_scheduling, test_unlock_nested_sched_lock)
 Validate nested k_sched_lock() and k_sched_unlock()
 
 ZTEST (threads_scheduling, test_wakeup_expired_timer_thread)
 validate k_wakeup() in some corner scenario
 

Variables

static struct thread_data tdata [3]
 
static struct k_thread tthread [3]
 
static int old_prio
 
static int init_prio
 
struct k_thread t
 
struct k_timer th_wakeup_timer
 
static int executed
 

Macro Definition Documentation

◆ DURATION

#define DURATION   K_MSEC(1)

◆ THREADS_NUM

#define THREADS_NUM   3

Function Documentation

◆ coop_thread()

static void coop_thread ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ K_SEM_DEFINE() [1/2]

K_SEM_DEFINE ( pend_sema  ,
,
 
)

◆ K_SEM_DEFINE() [2/2]

K_SEM_DEFINE ( timer_sema  ,
,
 
)

◆ setup_threads()

static void setup_threads ( void  )
static

◆ spawn_threads()

static void spawn_threads ( int  sleep_sec)
static

◆ teardown_threads()

static void teardown_threads ( void  )
static

◆ thread_entry()

static void thread_entry ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ thread_handler()

static void thread_handler ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ timer_handler()

static void timer_handler ( struct k_timer *  timer)
static

◆ ZTEST()

ZTEST ( threads_scheduling  ,
test_busy_wait_cooperative   
)

Variable Documentation

◆ executed

int executed
static

◆ init_prio

int init_prio
static

◆ old_prio

int old_prio
static

◆ t

struct k_thread t

◆ tdata

struct thread_data tdata[3]
static

◆ th_wakeup_timer

struct k_timer th_wakeup_timer

◆ tthread

struct k_thread tthread[3]
static