コード例 #1
0
static int pthread_timer_disable_continuous(void *data)
{
	struct pthread_timer *timer = data;

	ao2_lock(timer);
	if (timer->continuous) {
		timer->continuous = false;
		unsignal_pipe(timer);
	}
	ao2_unlock(timer);

	return 0;
}
コード例 #2
0
/*!
 * \internal
 * \pre timer is locked
 */
static void ack_ticks(struct pthread_timer *timer, unsigned int quantity)
{
	int pending_ticks = timer->pending_ticks;

	ast_assert(quantity);

	if (quantity > pending_ticks) {
		quantity = pending_ticks;
	}

	if (!quantity) {
		return;
	}

	timer->pending_ticks -= quantity;

	if ((0 == timer->pending_ticks) && !timer->continuous) {
		unsignal_pipe(timer);
	}
}
コード例 #3
0
static int pthread_timer_disable_continuous(int handle)
{
	struct pthread_timer *timer;

	if (!(timer = find_timer(handle, 0))) {
		errno = EINVAL;
		return -1;
	}

	ao2_lock(timer);
	if (timer->continuous) {
		timer->continuous = false;
		unsignal_pipe(timer);
	}
	ao2_unlock(timer);

	ao2_ref(timer, -1);

	return 0;
}