core/thread_flags: Avoid using inline w/o static
Apparently clang doesn't like static variables / functions being accessed called from inline function (-Wstatic-in-inline). This commit results in the same binary being generated while making clang happy.
This commit is contained in:
parent
57264c5059
commit
13575b2131
@ -26,6 +26,38 @@
|
|||||||
#define ENABLE_DEBUG (0)
|
#define ENABLE_DEBUG (0)
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
static inline int __attribute__((always_inline)) _thread_flags_wake(thread_t *thread)
|
||||||
|
{
|
||||||
|
unsigned wakeup;
|
||||||
|
thread_flags_t mask = (uint16_t)(unsigned)thread->wait_data;
|
||||||
|
|
||||||
|
switch (thread->status) {
|
||||||
|
case STATUS_FLAG_BLOCKED_ANY:
|
||||||
|
wakeup = (thread->flags & mask);
|
||||||
|
break;
|
||||||
|
case STATUS_FLAG_BLOCKED_ALL:
|
||||||
|
wakeup = ((thread->flags & mask) == mask);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wakeup = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wakeup) {
|
||||||
|
DEBUG("_thread_flags_wake(): waking up pid %" PRIkernel_pid "\n",
|
||||||
|
thread->pid);
|
||||||
|
sched_set_status(thread, STATUS_PENDING);
|
||||||
|
sched_context_switch_request = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wakeup;
|
||||||
|
}
|
||||||
|
|
||||||
|
int thread_flags_wake(thread_t *thread)
|
||||||
|
{
|
||||||
|
return _thread_flags_wake(thread);
|
||||||
|
}
|
||||||
|
|
||||||
static thread_flags_t _thread_flags_clear_atomic(thread_t *thread,
|
static thread_flags_t _thread_flags_clear_atomic(thread_t *thread,
|
||||||
thread_flags_t mask)
|
thread_flags_t mask)
|
||||||
{
|
{
|
||||||
@ -109,40 +141,13 @@ thread_flags_t thread_flags_wait_all(thread_flags_t mask)
|
|||||||
return _thread_flags_clear_atomic(me, mask);
|
return _thread_flags_clear_atomic(me, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int __attribute__((always_inline)) thread_flags_wake(thread_t *thread)
|
|
||||||
{
|
|
||||||
unsigned wakeup;
|
|
||||||
thread_flags_t mask = (uint16_t)(unsigned)thread->wait_data;
|
|
||||||
|
|
||||||
switch (thread->status) {
|
|
||||||
case STATUS_FLAG_BLOCKED_ANY:
|
|
||||||
wakeup = (thread->flags & mask);
|
|
||||||
break;
|
|
||||||
case STATUS_FLAG_BLOCKED_ALL:
|
|
||||||
wakeup = ((thread->flags & mask) == mask);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
wakeup = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wakeup) {
|
|
||||||
DEBUG("_thread_flags_wake(): waking up pid %" PRIkernel_pid "\n",
|
|
||||||
thread->pid);
|
|
||||||
sched_set_status(thread, STATUS_PENDING);
|
|
||||||
sched_context_switch_request = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return wakeup;
|
|
||||||
}
|
|
||||||
|
|
||||||
void thread_flags_set(thread_t *thread, thread_flags_t mask)
|
void thread_flags_set(thread_t *thread, thread_flags_t mask)
|
||||||
{
|
{
|
||||||
DEBUG("thread_flags_set(): setting 0x%08x for pid %" PRIkernel_pid "\n",
|
DEBUG("thread_flags_set(): setting 0x%08x for pid %" PRIkernel_pid "\n",
|
||||||
mask, thread->pid);
|
mask, thread->pid);
|
||||||
unsigned state = irq_disable();
|
unsigned state = irq_disable();
|
||||||
thread->flags |= mask;
|
thread->flags |= mask;
|
||||||
if (thread_flags_wake(thread)) {
|
if (_thread_flags_wake(thread)) {
|
||||||
irq_restore(state);
|
irq_restore(state);
|
||||||
thread_yield_higher();
|
thread_yield_higher();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user