kernel/poll.c
/* must be called with interrupts locked */
must be called with interrupts locked
must be called with interrupts locked
static inline int is_condition_met(struct k_poll_event *event, u32_t *state)
{
	switch (event->type) {
	case K_POLL_TYPE_SEM_AVAILABLE:
		if (k_sem_count_get(event->sem) > 0) {
			*state = K_POLL_STATE_SEM_AVAILABLE;
			return 1;
		}
		break;
	case K_POLL_TYPE_DATA_AVAILABLE:
		if (!k_queue_is_empty(event->queue)) {
			*state = K_POLL_STATE_FIFO_DATA_AVAILABLE;
			return 1;
		}
		break;
	case K_POLL_TYPE_SIGNAL:
		if (event->signal->signaled) {
			*state = K_POLL_STATE_SIGNALED;
			return 1;
		}
		break;
	case K_POLL_TYPE_IGNORE:
		return 0;
	default:
		__ASSERT(0, "invalid event type (0x%x)\n", event->type);
		break;
	}
	return 0;
}
static inline int is_condition_met ( struct k_poll_event * event , u32_t * state ) { switch ( event -> type ) { case K_POLL_TYPE_SEM_AVAILABLE : if ( k_sem_count_get ( event -> sem ) > 0 ) { * state = K_POLL_STATE_SEM_AVAILABLE ; return 1 ; } break ; case K_POLL_TYPE_DATA_AVAILABLE : if ( ! k_queue_is_empty ( event -> queue ) ) { * state = K_POLL_STATE_FIFO_DATA_AVAILABLE ; return 1 ; } break ; case K_POLL_TYPE_SIGNAL : if ( event -> signal -> signaled ) { * state = K_POLL_STATE_SIGNALED ; return 1 ; } break ; case K_POLL_TYPE_IGNORE : return 0 ; default : __ASSERT ( 0 , " \n " , event -> type ) ; break ; } return 0 ; }
must be called with interrupts locked
must be called with interrupts locked