Global scheduler suspend


Rob Meades
 

Apologies if I've missed this in the documentation but I'm looking for a way to suspend the Zephyr scheduler so that my task is not descheduled under any circumstances (until I re-enable the scheduler); I not been unable to find anything that does this so far.

I have found k_sched_lock() but that still deschedules the task should it do something that makes it unready. I've also found irq_lock() but again that is thread-specific so if the current thread is descheduled I'm back to where I started from.

Is there an organised way to good 'ole global scheduler suspend?

Rob


Rob Meades
 

Never mind: my motivation was to find a scheduler-suspension mechanism that works in the same way between Zephyr and FreeRTOS (since our code runs on both), and I thought the two were different but actually I think it ends up amounting to the same thing - FreeRTOS asserts if a suspended task does something to become unready (e.g. try to lock a mutex or send a message), rather than just rescheduling as Zephyr does, but all I need from this mechanism is to prevent RTOS-tick rescheduling and that is the same in both cases. I can fix it in the definition of the function.

Sorry for bothering!

Rob

-----Original Message-----
From: users@... [mailto:users@...] On Behalf Of Rob Meades via lists.zephyrproject.org
Sent: 05 March 2022 20:44
To: users@...
Subject: [Zephyr-users] Global scheduler suspend

*** This is an EXTERNAL email. It was sent from outside of u-blox. ***

Apologies if I've missed this in the documentation but I'm looking for a way to suspend the Zephyr scheduler so that my task is not descheduled under any circumstances (until I re-enable the scheduler); I not been unable to find anything that does this so far.

I have found k_sched_lock() but that still deschedules the task should it do something that makes it unready. I've also found irq_lock() but again that is thread-specific so if the current thread is descheduled I'm back to where I started from.

Is there an organised way to good 'ole global scheduler suspend?

Rob