导航:[首页]->[cpp]->[Cancellation Points]

可中断函数

通常为了和谐地退出,希望让子线程合理的退出并等待,那么若子线程卡在某个诸如select,sleep等函数时,怎么办呢?

以下函数是可中断函数,直接pthread_cancel就可以让其理解返回


accept()
aio_suspend()
clock_nanosleep()
close()
connect()
creat()
fcntl()2
fdatasync()
fsync()
getmsg()
getpmsg()
lockf()
mq_receive()
mq_send()
mq_timedreceive()
 


mq_timedsend()
msgrcv()
msgsnd()
msync()
nanosleep()
open()
pause()
poll()
pread()
pselect()
pthread_cond_timedwait()
pthread_cond_wait()
pthread_join()
pthread_testcancel()
putmsg()
 


putpmsg()
pwrite()
read()
readv()
recv()
recvfrom()
recvmsg()
select()
sem_timedwait()
sem_wait()
send()
sendmsg()
sendto()
sigpause()
sigsuspend()
 


sigtimedwait()
sigwait()
sigwaitinfo()
sleep()
system()
tcdrain()
usleep()
wait()
waitid()
waitpid()
write()
writev()
 

参考

  1. http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_09.html
  2. http://stackoverflow.com/questions/433989/posix-cancellation-points