Skip to content

Commit 9f38d2a

Browse files
Andrew BoieAnas Nashif
authored andcommitted
kernel: have k_sched_lock call _sched_lock
Having two implementations of the same thing is bad, especially when one can just call the other inline version. Signed-off-by: Andrew Boie <[email protected]>
1 parent 624a75c commit 9f38d2a

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

kernel/include/ksched.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,8 @@ static inline int _must_switch_threads(void)
239239
}
240240

241241
/*
242-
* Internal equivalent to k_sched_lock so that it does not incur a function
243-
* call penalty in the kernel guts.
244-
*
245-
* Must be kept in sync until the header files are cleaned-up and the
246-
* applications have access to the kernel internal deta structures (through
247-
* APIs of course).
242+
* Called directly by other internal kernel code.
243+
* Exposed to applications via k_sched_lock(), which just calls this
248244
*/
249245
static inline void _sched_lock(void)
250246
{

kernel/sched.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,7 @@ void _reschedule_threads(int key)
137137

138138
void k_sched_lock(void)
139139
{
140-
#ifdef CONFIG_PREEMPT_ENABLED
141-
__ASSERT(_current->base.sched_locked != 1, "");
142-
__ASSERT(!_is_in_isr(), "");
143-
144-
--_current->base.sched_locked;
145-
146-
/* Probably not needed since we're in a real function,
147-
* but it doesn't hurt.
148-
*/
149-
compiler_barrier();
150-
151-
K_DEBUG("scheduler locked (%p:%d)\n",
152-
_current, _current->base.sched_locked);
153-
#endif
140+
_sched_lock();
154141
}
155142

156143
void k_sched_unlock(void)

0 commit comments

Comments
 (0)