kernel: export k_sched_lock and k_sched_unlock.

Oversight. These functions are used extensively in the kernel guts, but
are also supposed to be an API.

k_sched_lock used to be implemented as a static inline. However, until
the header files are cleaned-up, and everything, including applications
get access to the kernel internal data structures, it must be
implemented as a function. To reduce the cost to the internals of the
kernel, the new internal _sched_lock() contains the same implemetation,
but is inlined.

Change-Id: If2f61d7714f87d81ddbeed69fedd111b8ce01376
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-11-10 14:46:58 -05:00 committed by Anas Nashif
commit d7ad176be6
8 changed files with 60 additions and 18 deletions

View file

@ -193,14 +193,14 @@ static inline int _must_switch_threads(void)
}
/*
* Application API.
* Internal equivalent to k_sched_lock so that it does not incur a function
* call penalty in the kernel guts.
*
* lock the scheduler: prevents another thread from preempting the current one
* except if the current thread does an operation that causes it to pend
*
* Can be called recursively.
* Must be kept in sync until the header files are cleaned-up and the
* applications have access to the kernel internal deta structures (through
* APIs of course).
*/
static inline void k_sched_lock(void)
static inline void _sched_lock(void)
{
__ASSERT(!_is_in_isr(), "");