src/libruntime/mailbox.c
/**
 * @brief Allocates a mailbox.
 *
 * @return Upon successful completion, the ID of the newly allocated
 * mailbox is returned. Upon failure, -1 is returned instead.
 *
 * @note this function is @b not thread safe.
 */
@brief Allocates a mailbox.
@return Upon successful completion, the ID of the newly allocated
mailbox is returned. Upon failure, -1 is returned instead.

@note this function is @b not thread safe.
@brief Allocates a mailbox . @return Upon successful completion the ID of the newly allocated mailbox is returned . Upon failure - 1 is returned instead . @note this function is @b not thread safe .
static int nanvix_mailbox_alloc(void)
{
	for (int i = 0; i < NANVIX_MAILBOX_MAX; i++)
	{
		if (!nanvix_mailbox_is_used(i))
		{
			nanvix_mailbox_set_used(i);
			return (i);
		}
	}
	uprintf("[NAME] mailbox table overflow\n");
	return (-1);
}
static int nanvix_mailbox_alloc ( void ) { for ( int i = 0 ; i < NANVIX_MAILBOX_MAX ; i ++ ) { if ( ! nanvix_mailbox_is_used ( i ) ) { nanvix_mailbox_set_used ( i ) ; return ( i ) ; } } uprintf ( " \n " ) ; return ( -1 ) ; }
@brief Allocates a mailbox.
@brief Allocates a mailbox .
/* Search for a free mailbox. */ /* Found. */