Beispiel #1
0
void fiber_delayed_start_cancel(void *handle)
{
	struct tcs *cancelled_tcs = (struct tcs *)handle;
	int key = irq_lock();

	_nano_timeout_abort(cancelled_tcs);
	_thread_exit(cancelled_tcs);

	irq_unlock(key);
}
Beispiel #2
0
void _fiber_wakeup(nano_thread_id_t fiber)
{
	int key = irq_lock();

	/* verify first if fiber is not waiting on an object */
	if (!fiber->nano_timeout.wait_q && (_nano_timeout_abort(fiber) == 0)) {
		_nano_fiber_ready(fiber);
	}

	irq_unlock(key);
}
Beispiel #3
0
void task_fiber_wakeup(nano_thread_id_t fiber)
{
	int key = irq_lock();

	/* verify first if fiber is not waiting on an object */
	if ((fiber->nano_timeout.wait_q) || (_nano_timeout_abort(fiber) < 0)) {
		irq_unlock(key);
	} else {
		_nano_fiber_ready(fiber);
		_Swap(key);
	}
}
Beispiel #4
0
/**
 * INTERNAL
 * This function is capable of supporting invocations from both a fiber and an
 * ISR context.  However, the nano_isr_sem_give and nano_fiber_sem_give aliases
 * are created to support any required implementation differences in the future
 * without introducing a source code migration issue.
 */
void _sem_give_non_preemptible(struct nano_sem *sem)
{
	tCCS *ccs;
	unsigned int imask;

	imask = irq_lock_inline();
	ccs = _nano_wait_q_remove(&sem->wait_q);
	if (!ccs) {
		sem->nsig++;
	} else {
		_nano_timeout_abort(ccs);
		set_sem_available(ccs);
	}

	irq_unlock_inline(imask);
}
Beispiel #5
0
/** INTERNAL
 *
 * This function is capable of supporting invocations from both a fiber and an
 * ISR context.  However, the nano_isr_lifo_put and nano_fiber_lifo_put aliases
 * are created to support any required implementation differences in the future
 * without introducing a source code migration issue.
 */
void _lifo_put_non_preemptible(struct nano_lifo *lifo, void *data)
{
	tCCS *ccs;
	unsigned int imask;

	imask = irq_lock_inline();
	ccs = _nano_wait_q_remove(&lifo->wait_q);
	if (ccs) {
		_nano_timeout_abort(ccs);
		fiberRtnValueSet(ccs, (unsigned int) data);
	} else {
		*(void **) data = lifo->list;
		lifo->list = data;
	}

	irq_unlock_inline(imask);
}
Beispiel #6
0
void nano_task_sem_give(struct nano_sem *sem)
{
	tCCS *ccs;
	unsigned int imask;

	imask = irq_lock_inline();
	ccs = _nano_wait_q_remove(&sem->wait_q);
	if (ccs) {
		_nano_timeout_abort(ccs);
		set_sem_available(ccs);
		_Swap(imask);
		return;
	} else {
		sem->nsig++;
	}

	irq_unlock_inline(imask);
}
Beispiel #7
0
void nano_task_lifo_put(struct nano_lifo *lifo, void *data)
{
	struct tcs *tcs;
	unsigned int imask;

	imask = irq_lock();
	tcs = _nano_wait_q_remove(&lifo->wait_q);
	if (tcs) {
		_nano_timeout_abort(tcs);
		fiberRtnValueSet(tcs, (unsigned int) data);
		_Swap(imask);
		return;
	}

	*(void **) data = lifo->list;
	lifo->list = data;

	irq_unlock(imask);
}