当前位置: 首页>>代码示例>>C++>>正文


C++ clockid_to_kclock函数代码示例

本文整理汇总了C++中clockid_to_kclock函数的典型用法代码示例。如果您正苦于以下问题:C++ clockid_to_kclock函数的具体用法?C++ clockid_to_kclock怎么用?C++ clockid_to_kclock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了clockid_to_kclock函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: itimer_delete

/*
 * return timer owned by the process, used by exit_itimers
 */
static void itimer_delete(struct k_itimer *timer)
{
	unsigned long flags;

retry_delete:
	spin_lock_irqsave(&timer->it_lock, flags);

	/* On RT we can race with a deletion */
	if (!timer->it_signal) {
		unlock_timer(timer, flags);
		return;
	}

	if (timer_delete_hook(timer) == TIMER_RETRY) {
		rcu_read_lock();
		unlock_timer(timer, flags);
		timer_wait_for_callback(clockid_to_kclock(timer->it_clock),
					timer);
		rcu_read_unlock();
		goto retry_delete;
	}
	list_del(&timer->list);
	/*
	 * This keeps any tasks waiting on the spin lock from thinking
	 * they got something (see the lock code above).
	 */
	timer->it_signal = NULL;

	unlock_timer(timer, flags);
	release_posix_timer(timer, IT_ID_SET);
}
开发者ID:garyvan,项目名称:openwrt-1.6,代码行数:34,代码来源:posix-timers.c

示例2: SYSCALL_DEFINE1

/* Delete a POSIX.1b interval timer. */
SYSCALL_DEFINE1(timer_delete, timer_t, timer_id)
{
	struct k_itimer *timer;
	unsigned long flags;

retry_delete:
	timer = lock_timer(timer_id, &flags);
	if (!timer)
		return -EINVAL;

	rcu_read_lock();
	if (timer_delete_hook(timer) == TIMER_RETRY) {
		unlock_timer(timer, flags);
		timer_wait_for_callback(clockid_to_kclock(timer->it_clock),
					timer);
		rcu_read_unlock();
		goto retry_delete;
	}
	rcu_read_unlock();

	spin_lock(&current->sighand->siglock);
	list_del(&timer->list);
	spin_unlock(&current->sighand->siglock);
	/*
	 * This keeps any tasks waiting on the spin lock from thinking
	 * they got something (see the lock code above).
	 */
	timer->it_signal = NULL;

	unlock_timer(timer, flags);
	release_posix_timer(timer, IT_ID_SET);
	return 0;
}
开发者ID:garyvan,项目名称:openwrt-1.6,代码行数:34,代码来源:posix-timers.c

示例3: SYSCALL_DEFINE3

SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
		struct sigevent __user *, timer_event_spec,
		timer_t __user *, created_timer_id)
{
	struct k_clock *kc = clockid_to_kclock(which_clock);
	struct k_itimer *new_timer;
	int error, new_timer_id;
	sigevent_t event;
	int it_id_set = IT_ID_NOT
开发者ID:varunbhat,项目名称:linux,代码行数:9,代码来源:posix-timers.c

示例4: SYSCALL_DEFINE4

/* Set a POSIX.1b interval timer */
SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
		const struct itimerspec __user *, new_setting,
		struct itimerspec __user *, old_setting)
{
	struct k_itimer *timr;
	struct itimerspec new_spec, old_spec;
	int error = 0;
	unsigned long flag;
	struct itimerspec *rtn = old_setting ? &old_spec : NULL;
	struct k_clock *kc;

	if (!new_setting)
		return -EINVAL;

	if (copy_from_user(&new_spec, new_setting, sizeof (new_spec)))
		return -EFAULT;

	if (!timespec_valid(&new_spec.it_interval) ||
	    !timespec_valid(&new_spec.it_value))
		return -EINVAL;
retry:
	timr = lock_timer(timer_id, &flag);
	if (!timr)
		return -EINVAL;

	rcu_read_lock();
	kc = clockid_to_kclock(timr->it_clock);
	if (WARN_ON_ONCE(!kc || !kc->timer_set))
		error = -EINVAL;
	else
		error = kc->timer_set(timr, flags, &new_spec, rtn);

	unlock_timer(timr, flag);
	if (error == TIMER_RETRY) {
		timer_wait_for_callback(kc, timr);
		rtn = NULL;	// We already got the old time...
		rcu_read_unlock();
		goto retry;
	}
	rcu_read_unlock();

	if (old_setting && !error &&
	    copy_to_user(old_setting, &old_spec, sizeof (old_spec)))
		error = -EFAULT;

	return error;
}
开发者ID:garyvan,项目名称:openwrt-1.6,代码行数:48,代码来源:posix-timers.c


注:本文中的clockid_to_kclock函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。