All pastes #763947 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-06 21:12 UTC
rendered paste body
/* Close the mailbox with handle q  */
int mbox_close(int q)
{
	mbox_t *box;
	if (key < 0 || key >= MAX_MBOX)
		return -1;

	box = Q[key];
	lock_acquire(&box->l);
	/* We could assert here that box->used > 0 */
	box->used--;
	lock_release(&box->l);
	return 1;
}