kernel/mem_pool.c
/**
 *
 * @brief Examine threads that are waiting for memory pool blocks.
 *
 * This routine attempts to satisfy any incomplete block allocation requests for
 * the specified memory pool. It can be invoked either by the explicit freeing
 * of a used block or as a result of defragmenting the pool (which may create
 * one or more new, larger blocks).
 *
 * @return N/A
 */
@brief Examine threads that are waiting for memory pool blocks.
This routine attempts to satisfy any incomplete block allocation requests for
the specified memory pool. It can be invoked either by the explicit freeing
of a used block or as a result of defragmenting the pool (which may create
one or more new, larger blocks).

@return N/A
@brief Examine threads that are waiting for memory pool blocks . This routine attempts to satisfy any incomplete block allocation requests for the specified memory pool . It can be invoked either by the explicit freeing of a used block or as a result of defragmenting the pool ( which may create one or more new larger blocks ) . @return N / A
static void block_waiters_check(struct k_mem_pool *pool)
{
	char *found_block;
	struct k_thread *waiter;
	struct k_thread *next_waiter;
	int offset;
	unsigned int key = irq_lock();
	waiter = (struct k_thread *)sys_dlist_peek_head(&pool->wait_q);
	while (waiter != NULL) {
		u32_t req_size = (u32_t)(waiter->base.swap_data);
		offset = compute_block_set_index(pool, req_size);
		found_block = get_block_recursive(pool, offset, offset);
		next_waiter = (struct k_thread *)sys_dlist_peek_next(
			&pool->wait_q, &waiter->base.k_q_node);
		if (found_block != NULL) {
			_set_thread_return_value_with_data(waiter, 0,
							   found_block);
			_unpend_thread(waiter);
			_abort_thread_timeout(waiter);
			_ready_thread(waiter);
		}
		waiter = next_waiter;
	}
	irq_unlock(key);
}
static void block_waiters_check ( struct k_mem_pool * pool ) { char * found_block ; struct k_thread * waiter ; struct k_thread * next_waiter ; int offset ; unsigned int key = irq_lock ( ) ; waiter = ( struct k_thread * ) sys_dlist_peek_head ( & pool -> wait_q ) ; while ( waiter != NULL ) { u32_t req_size = ( u32_t ) ( waiter -> base . swap_data ) ; offset = compute_block_set_index ( pool , req_size ) ; found_block = get_block_recursive ( pool , offset , offset ) ; next_waiter = ( struct k_thread * ) sys_dlist_peek_next ( & pool -> wait_q , & waiter -> base . k_q_node ) ; if ( found_block != NULL ) { _set_thread_return_value_with_data ( waiter , 0 , found_block ) ; _unpend_thread ( waiter ) ; _abort_thread_timeout ( waiter ) ; _ready_thread ( waiter ) ; } waiter = next_waiter ; } irq_unlock ( key ) ; }
@brief Examine threads that are waiting for memory pool blocks.
@brief Examine threads that are waiting for memory pool blocks .
/* loop all waiters */ /* locate block set to try allocating from */ /* allocate block (fragmenting a larger block, if needed) */ /* if success : remove task from list and reschedule */ /* return found block */ /*
			 * Schedule the thread. Threads will be rescheduled
			 * outside the function by k_sched_unlock()
			 */