kernel/poll.c
/* must be called with interrupts locked */
must be called with interrupts locked
must be called with interrupts locked
static int _signal_poll_event(struct k_poll_event *event, u32_t state,
			      int *must_reschedule)
{
	*must_reschedule = 0;
	if (!event->poller) {
		goto ready_event;
	}
	struct k_thread *thread = event->poller->thread;
	__ASSERT(event->poller->thread, "poller should have a thread\n");
	clear_polling_state(thread);
	if (!_is_thread_pending(thread)) {
		goto ready_event;
	}
	if (_is_thread_timeout_expired(thread)) {
		return -EAGAIN;
	}
	_unpend_thread(thread);
	_abort_thread_timeout(thread);
	_set_thread_return_value(thread, 0);
	if (!_is_thread_ready(thread)) {
		goto ready_event;
	}
	_add_thread_to_ready_q(thread);
	*must_reschedule = !_is_in_isr() && _must_switch_threads();
ready_event:
	set_event_ready(event, state);
	return 0;
}
static int _signal_poll_event ( struct k_poll_event * event , u32_t state , int * must_reschedule ) { * must_reschedule = 0 ; if ( ! event -> poller ) { goto ready_event ; } struct k_thread * thread = event -> poller -> thread ; __ASSERT ( event -> poller -> thread , " \n " ) ; clear_polling_state ( thread ) ; if ( ! _is_thread_pending ( thread ) ) { goto ready_event ; } if ( _is_thread_timeout_expired ( thread ) ) { return - EAGAIN ; } _unpend_thread ( thread ) ; _abort_thread_timeout ( thread ) ; _set_thread_return_value ( thread , 0 ) ; if ( ! _is_thread_ready ( thread ) ) { goto ready_event ; } _add_thread_to_ready_q ( thread ) ; * must_reschedule = ! _is_in_isr ( ) && _must_switch_threads ( ) ; ready_event : set_event_ready ( event , state ) ; return 0 ; }
must be called with interrupts locked
must be called with interrupts locked