tests: Use z_pend_curr() in sched benchmark
Replaces the use of z_pend_curr_irqlock() with z_pend_curr() as the former is not used anywhere else anymore. Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
parent
9fa4cd8226
commit
a55a078909
1 changed files with 6 additions and 4 deletions
|
@ -13,14 +13,14 @@
|
|||
* of specific low level scheduling primitives independent of overhead
|
||||
* from application or API abstractions. It works very simply: a main
|
||||
* thread creates a "partner" thread at a higher priority, the partner
|
||||
* then sleeps using z_pend_curr_irqlock(). From this initial
|
||||
* then sleeps using z_pend_curr(). From this initial
|
||||
* state:
|
||||
*
|
||||
* 1. The main thread calls z_unpend_first_thread()
|
||||
* 2. The main thread calls z_ready_thread()
|
||||
* 3. The main thread calls k_yield()
|
||||
* (the kernel switches to the partner thread)
|
||||
* 4. The partner thread then runs and calls z_pend_curr_irqlock() again
|
||||
* 4. The partner thread then runs and calls z_pend_curr() again
|
||||
* (the kernel switches to the main thread)
|
||||
* 5. The main thread returns from k_yield()
|
||||
*
|
||||
|
@ -49,6 +49,8 @@ enum {
|
|||
|
||||
uint32_t stamps[NUM_STAMP_STATES];
|
||||
|
||||
static struct k_spinlock lock;
|
||||
|
||||
static inline int _stamp(int state)
|
||||
{
|
||||
uint32_t t;
|
||||
|
@ -79,9 +81,9 @@ static void partner_fn(void *arg1, void *arg2, void *arg3)
|
|||
printk("Running %p\n", k_current_get());
|
||||
|
||||
while (true) {
|
||||
unsigned int key = irq_lock();
|
||||
k_spinlock_key_t key = k_spin_lock(&lock);
|
||||
|
||||
z_pend_curr_irqlock(key, &waitq, K_FOREVER);
|
||||
z_pend_curr(&lock, key, &waitq, K_FOREVER);
|
||||
stamp(PARTNER_AWAKE_PENDING);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue