POSIX取消点是什么? [英] What are the POSIX cancellation points?

查看:69
本文介绍了POSIX取消点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是POSIX取消点?我正在寻找POSIX取消点的明确列表.

What are the POSIX cancellation points? I'm looking for a definitive list of POSIX cancellation points.

我之所以问是因为我有一本书说accept()select()是取消点,但是我看到互联网上的网站声称它们不是取消点.

I'm asking because I have a book that says accept() and select() are cancellation points, but I've seen sites on the internet claim that they are not.

此外,如果Linux取消点与POSIX取消点不同,我也要列出它们.

Also, if Linux cancellation points are different than POSIX cancellation points I want a list of them too.

推荐答案

POSIX 1003.1- 2003 标准在系统接口"部分提供了一个列表,然后是常规信息",然后是线程"(直接链接(由A. Rex提供). (已添加: POSIX 1003.1-2008 现在可用在网络上(所有3872页,PDF和HTML格式).您必须注册(免费).我从

The POSIX 1003.1-2003 standard gives a list in the System Interfaces section, then General Information, then Threads (direct link courtesy of A. Rex). (Added: POSIX 1003.1-2008 is now available on the web (all 3872 pages of it, in PDF and HTML). You have to register (free). I got to it from the Open Group Bookstore.)

当线程执行以下功能时,将发生取消点:

Cancellation points shall occur when a thread is executing the following functions:

  • accept()
  • aio_suspend()
  • clock_nanosleep()
  • close()
  • connect()
  • creat()
  • fcntl()(当cmd参数为F_SETLKW时)
  • fdatasync()
  • fsync()
  • getmsg()
  • getpmsg()
  • lockf()
  • mq_receive()
  • mq_send()
  • mq_timedreceive()
  • mq_timedsend()
  • msgrcv()
  • msgsnd()
  • msync()
  • nanosleep()
  • open()
  • pause()
  • 民意调查()
  • 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()
  • 发送()
  • sendmsg()
  • sendto()
  • sigpause()
  • sigsuspend()
  • sigtimedwait()
  • sigwait()
  • sigwaitinfo()
  • sleep()
  • system()
  • tcdrain()
  • usleep()
  • wait()
  • waidid()
  • waitpid()
  • write()
  • writev()
  • accept()
  • aio_suspend()
  • clock_nanosleep()
  • close()
  • connect()
  • creat()
  • fcntl() (When the cmd argument is F_SETLKW)
  • 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()
  • waidid()
  • waitpid()
  • write()
  • writev()


当线程执行以下功能时,取消点也可能会出现:

A cancellation point may also occur when a thread is executing the following functions:


  • access()
  • asctime()
  • asctime_r()
  • catclose()
  • catgets()
  • catopen()
  • closedir()
  • closelog()
  • ctermid()
  • ctime()
  • ctime_r()
  • dbm_close()
  • dbm_delete()
  • dbm_fetch()
  • dbm_nextkey()
  • dbm_open()
  • dbm_store()
  • dlclose()
  • dlopen()
  • endgrent()
  • endhostent()
  • endnetent()
  • endprotoent()
  • endpwent()
  • endservent()
  • endutxent()
  • fclose()
  • fcntl()(用于cmd参数的任何值.[大概是列出的F_SETLKW除外.]
  • fflush()
  • fgetc()
  • fgetpos()
  • fgets()
  • fgetwc()
  • fgetws()
  • fmtmsg()
  • fopen()
  • fpathconf()
  • fprintf()
  • fputc()
  • fputs()
  • fputwc()
  • fputws()
  • fread()
  • freopen()
  • fscanf()
  • fseek()
  • fseeko()
  • fsetpos()
  • fstat()
  • ftell()
  • ftello()
  • ftw()
  • fwprintf()
  • fwrite()
  • fwscanf()
  • getaddrinfo()
  • getc()
  • getc_unlocked()
  • getchar()
  • getchar_unlocked()
  • getcwd()
  • getdate()
  • getgrent()
  • getgrgid()
  • getgrgid_r()
  • getgrnam()
  • getgrnam_r()
  • gethostbyaddr()
  • gethostbyname()
  • gethostent()
  • gethostid()
  • gethostname()
  • getlogin()
  • getlogin_r()
  • getnameinfo()
  • getnetbyaddr()
  • getnetbyname()
  • getnetent()
  • getopt()(如果 opterr 不为零.)
  • getprotobyname()
  • getprotobynumber()
  • getprotoent()
  • getpwent()
  • getpwnam()
  • getpwnam_r()
  • getpwuid()
  • getpwuid_r()
  • gets()
  • getservbyname()
  • getservbyport()
  • getservent()
  • getutxent()
  • getutxid()
  • getutxline()
  • getwc()
  • getwchar()
  • getwd()
  • glob()
  • iconv_close()
  • iconv_open()
  • ioctl()
  • link()
  • localtime()
  • localtime_r()
  • lseek()
  • lstat()
  • mkstemp()
  • mktime()
  • nftw()
  • opendir()
  • openlog()
  • pathconf()
  • pclose()
  • perror()
  • popen()
  • posix_fadvise()
  • posix_fallocate()
  • posix_madvise()
  • posix_openpt()
  • posix_spawn()
  • posix_spawnp()
  • posix_trace_clear()
  • posix_trace_close()
  • posix_trace_create()
  • posix_trace_create_withlog()
  • posix_trace_eventtypelist_getne
  • posix_trace_eventtypelist_rewin
  • posix_trace_flush()
  • posix_trace_get_attr()
  • posix_trace_get_filter()
  • posix_trace_get_status()
  • posix_trace_getnext_event()
  • posix_trace_open()
  • posix_trace_rewind()
  • posix_trace_set_filter()
  • posix_trace_shutdown()
  • posix_trace_timedgetnext_event(
  • posix_typed_mem_open()
  • printf()
  • pthread_rwlock_rdlock()
  • pthread_rwlock_timedrdlock()
  • pthread_rwlock_timedwrlock()
  • pthread_rwlock_wrlock()
  • putc()
  • putc_unlocked()
  • putchar()
  • putchar_unlocked()
  • puts()
  • pututxline()
  • putwc()
  • putwchar()
  • readdir()
  • readdir_r()
  • 删除()
  • 重命名()
  • rewind()
  • rewinddir()
  • scanf()
  • seekdir()
  • semop()
  • setgrent()
  • sethostent()
  • setnetent()
  • setprotoent()
  • setpwent()
  • setservent()
  • setutxent()
  • stat()
  • strerror()
  • strerror_r()
  • strftime()
  • symlink()
  • sync()
  • syslog()
  • tmpfile()
  • tmpnam()
  • ttyname()
  • ttyname_r()
  • tzset()
  • ungetc()
  • ungetwc()
  • unlink()
  • vfprintf()
  • vfwprintf()
  • vprintf()
  • vwprintf()
  • wcsftime()
  • wordexp()
  • wprintf()
  • wscanf()
  • access()
  • asctime()
  • asctime_r()
  • catclose()
  • catgets()
  • catopen()
  • closedir()
  • closelog()
  • ctermid()
  • ctime()
  • ctime_r()
  • dbm_close()
  • dbm_delete()
  • dbm_fetch()
  • dbm_nextkey()
  • dbm_open()
  • dbm_store()
  • dlclose()
  • dlopen()
  • endgrent()
  • endhostent()
  • endnetent()
  • endprotoent()
  • endpwent()
  • endservent()
  • endutxent()
  • fclose()
  • fcntl() (For any value of the cmd argument. [Presumably except F_SETLKW which is listed.]
  • fflush()
  • fgetc()
  • fgetpos()
  • fgets()
  • fgetwc()
  • fgetws()
  • fmtmsg()
  • fopen()
  • fpathconf()
  • fprintf()
  • fputc()
  • fputs()
  • fputwc()
  • fputws()
  • fread()
  • freopen()
  • fscanf()
  • fseek()
  • fseeko()
  • fsetpos()
  • fstat()
  • ftell()
  • ftello()
  • ftw()
  • fwprintf()
  • fwrite()
  • fwscanf()
  • getaddrinfo()
  • getc()
  • getc_unlocked()
  • getchar()
  • getchar_unlocked()
  • getcwd()
  • getdate()
  • getgrent()
  • getgrgid()
  • getgrgid_r()
  • getgrnam()
  • getgrnam_r()
  • gethostbyaddr()
  • gethostbyname()
  • gethostent()
  • gethostid()
  • gethostname()
  • getlogin()
  • getlogin_r()
  • getnameinfo()
  • getnetbyaddr()
  • getnetbyname()
  • getnetent()
  • getopt() (if opterr is non-zero.)
  • getprotobyname()
  • getprotobynumber()
  • getprotoent()
  • getpwent()
  • getpwnam()
  • getpwnam_r()
  • getpwuid()
  • getpwuid_r()
  • gets()
  • getservbyname()
  • getservbyport()
  • getservent()
  • getutxent()
  • getutxid()
  • getutxline()
  • getwc()
  • getwchar()
  • getwd()
  • glob()
  • iconv_close()
  • iconv_open()
  • ioctl()
  • link()
  • localtime()
  • localtime_r()
  • lseek()
  • lstat()
  • mkstemp()
  • mktime()
  • nftw()
  • opendir()
  • openlog()
  • pathconf()
  • pclose()
  • perror()
  • popen()
  • posix_fadvise()
  • posix_fallocate()
  • posix_madvise()
  • posix_openpt()
  • posix_spawn()
  • posix_spawnp()
  • posix_trace_clear()
  • posix_trace_close()
  • posix_trace_create()
  • posix_trace_create_withlog()
  • posix_trace_eventtypelist_getne
  • posix_trace_eventtypelist_rewin
  • posix_trace_flush()
  • posix_trace_get_attr()
  • posix_trace_get_filter()
  • posix_trace_get_status()
  • posix_trace_getnext_event()
  • posix_trace_open()
  • posix_trace_rewind()
  • posix_trace_set_filter()
  • posix_trace_shutdown()
  • posix_trace_timedgetnext_event(
  • posix_typed_mem_open()
  • printf()
  • pthread_rwlock_rdlock()
  • pthread_rwlock_timedrdlock()
  • pthread_rwlock_timedwrlock()
  • pthread_rwlock_wrlock()
  • putc()
  • putc_unlocked()
  • putchar()
  • putchar_unlocked()
  • puts()
  • pututxline()
  • putwc()
  • putwchar()
  • readdir()
  • readdir_r()
  • remove()
  • rename()
  • rewind()
  • rewinddir()
  • scanf()
  • seekdir()
  • semop()
  • setgrent()
  • sethostent()
  • setnetent()
  • setprotoent()
  • setpwent()
  • setservent()
  • setutxent()
  • stat()
  • strerror()
  • strerror_r()
  • strftime()
  • symlink()
  • sync()
  • syslog()
  • tmpfile()
  • tmpnam()
  • ttyname()
  • ttyname_r()
  • tzset()
  • ungetc()
  • ungetwc()
  • unlink()
  • vfprintf()
  • vfwprintf()
  • vprintf()
  • vwprintf()
  • wcsftime()
  • wordexp()
  • wprintf()
  • wscanf()


实现不得将取消点引入此IEEE Std 1003.1-2001卷中指定的任何其他功能中.

An implementation shall not introduce cancellation points into any other functions specified in this volume of IEEE Std 1003.1-2001.

在函数调用期间挂起时对取消请求进行操作的副作用与在单线程程序中通过信号中断对函数的调用而中断的副作用相同.给定的函数返回[EINTR].任何此类副作用都会在调用任何取消清除处理程序之前发生.

The side effects of acting upon a cancellation request while suspended during a call of a function are the same as the side effects that may be seen in a single-threaded program when a call to a function is interrupted by a signal and the given function returns [EINTR]. Any such side effects occur before any cancellation cleanup handlers are called.

每当一个线程启用取消功能并且以该线程为目标发出取消请求,然后该线程就会调用作为取消点的任何函数(例如pthread_testcancel()或read()),即取消请求在函数返回之前应采取行动.如果线程启用了取消功能,并且在线程悬停在取消点的同时以该线程为目标发出了取消请求,则应唤醒该线程并执行取消请求.但是,如果线程在取消点处挂起,并且等待其事件发生在对取消请求执行操作之前,则无法确定是否对取消请求执行操作或取消请求是否仍处于挂起状态,并且线程恢复正常状态执行.

Whenever a thread has cancelability enabled and a cancellation request has been made with that thread as the target, and the thread then calls any function that is a cancellation point (such as pthread_testcancel() or read()), the cancellation request shall be acted upon before the function returns. If a thread has cancelability enabled and a cancellation request is made with the thread as a target while the thread is suspended at a cancellation point, the thread shall be awakened and the cancellation request shall be acted upon. However, if the thread is suspended at a cancellation point and the event for which it is waiting occurs before the cancellation request is acted upon, it is unspecified whether the cancellation request is acted upon or whether the cancellation request remains pending and the thread resumes normal execution.

U!无法使表格很好地工作,它在预览中看起来还不错,事后没有表格.查看URL以获取信息! 有很多可能的取消点.

Ugh! Can't get the table to work very well it looked OK in preview and nothing like a table afterwards. Look at the URL for the information! There are a lot of possible cancellation points.

这篇关于POSIX取消点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆