本文整理汇总了C++中release_posix_timer函数的典型用法代码示例。如果您正苦于以下问题:C++ release_posix_timer函数的具体用法?C++ release_posix_timer怎么用?C++ release_posix_timer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了release_posix_timer函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: sys_timer_control
//.........这里部分代码省略.........
ulong_t itx=time_to_ticks(&tspec.it_interval);
/* We need to hold the lock during the whole process, so lookup
* target timer explicitely.
*/
LOCK_POSIX_STUFF_W(stuff);
ptimer=(posix_timer_t*)__posix_locate_object(stuff,id,POSIX_OBJ_TIMER);
if( !ptimer ) {
break;
}
ktimer=&ptimer->ktimer;
if( !(tspec.it_value.tv_sec | tspec.it_value.tv_nsec) ) {
if( ktimer->time_x && posix_timer_active(ptimer) ) { /* Disarm active timer */
#ifdef CONFIG_DEBUG_TIMERS
kprintf_fault("sys_timer_control() [%d:%d]: Tick=%d, deactivating timer %p:(P=%d) to %d\n",
current_task()->pid,current_task()->tid,
system_ticks,ktimer,ptimer->interval,tx);
#endif
deactivate_posix_timer(ptimer);
delete_timer(ktimer);
}
r=0;
} else if( valid_timeval ) {
if( !(arg1 & TIMER_ABSTIME) ) {
tx+=system_ticks;
}
ptimer->interval=itx;
activate_posix_timer(ptimer);
if( ktimer->time_x ) { /* New time for active timer. */
#ifdef CONFIG_DEBUG_TIMERS
kprintf_fault("sys_timer_control() [%d:%d] <RE-ARM> Tick=%d, timer=%p:(Tv=%d/%d,Pv=%d/%d,ABS=%d) to %d\n",
current_task()->pid,current_task()->tid,
system_ticks,ktimer,
tspec.it_value.tv_sec,tspec.it_value.tv_nsec,
tspec.it_interval.tv_sec,tspec.it_interval.tv_nsec,
(arg1 & TIMER_ABSTIME) != 0,
tx);
#endif
r=modify_timer(ktimer,tx);
} else {
TIMER_RESET_TIME(ktimer,tx);
#ifdef CONFIG_DEBUG_TIMERS
kprintf_fault("sys_timer_control() <ARM> [%d:%d] Tick=%d, timer=%p:(Tv=%d/%d,Pv=%d/%d,ABS=%d) to %d\n",
current_task()->pid,current_task()->tid,
system_ticks,ktimer,
tspec.it_value.tv_sec,tspec.it_value.tv_nsec,
tspec.it_interval.tv_sec,tspec.it_interval.tv_nsec,
(arg1 & TIMER_ABSTIME) != 0,
tx);
#endif
r=add_timer(ktimer);
}
}
UNLOCK_POSIX_STUFF_W(stuff);
if( !r && arg3 ) {
__get_timer_status(ptimer,&kspec);
if( copy_to_user((itimerspec_t *)arg3,&kspec,sizeof(kspec)) ) {
r=-EFAULT;
/* TODO: [mt] Cleanup timer upon -EFAULT. */
}
}
}
break;
case __POSIX_TIMER_GETTIME:
ptimer=posix_lookup_timer(stuff,id);
if( !ptimer ) {
break;
}
__get_timer_status(ptimer,&kspec);
r=copy_to_user((itimerspec_t *)arg1,&kspec,sizeof(kspec)) ? -EFAULT : 0;
break;
case __POSIX_TIMER_GETOVERRUN:
ptimer=posix_lookup_timer(stuff,id);
if( !ptimer ) {
break;
}
r=ptimer->overrun;
break;
default:
r=-EINVAL;
break;
}
if( ptimer ) {
release_posix_timer(ptimer);
}
#ifdef CONFIG_DEBUG_TIMERS
kprintf_fault("sys_timer_control(<END>) [%d:%d]: Tick=%d, (cmd=%d,id=%d), result=%d\n",
current_task()->pid,current_task()->tid,
system_ticks,cmd,id,r);
#endif
return ERR(r);
}