Re: [問題] pthread問題
這是其中一個版本,也就是只影響thread的
( POSIX Programmer's Manual (P) Updated: 2003 )
The sleep() function shall cause the calling thread to be suspended from
execution until either the number of realtime seconds specified by the
argument seconds has elapsed or a signal is delivered to the calling thread
and its action is to invoke a signal-catching function or to terminate the
process. The suspension time may be longer than requested due to the
scheduling of other activity by the system.
在這個說明底下有的Rationale
There are two general approaches to the implementation of the sleep()
function.
One is to use the alarm() function to schedule a SIGALRM signal and
then suspend the process waiting for that signal.
The other is to implement an independent facility.
This volume of IEEE Std 1003.1-2001 permits either
approach.
...
=========================================================================
這是另一個版本 ,影響process的sleep
( Linux Programmer's Manual (3 ) Updated: 1993-04-07 )
sleep() makes the current process sleep until seconds seconds have elapsed or
a signal arrives which is not ignored.
-----------------
我不曉得pthread_delay_np
不過應該可以用pthread_cond_timedwait達成
timespec.tv_sec = time(NULL) + 秒
timespec.tv_nsec = 0;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.171.83.59
※ 編輯: sunneo 來自: 118.171.83.59 (08/08 15:06)
推
08/08 15:54, , 1F
08/08 15:54, 1F
推
08/08 15:57, , 2F
08/08 15:57, 2F
推
08/09 08:35, , 3F
08/09 08:35, 3F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 3 篇):
問題
3
9