pthread_exit 函数 man 手册翻译

PTHREAD_EXIT(3)                    Linux Programmer's Manual                     PTHREAD_EXIT(3)



NAME
       pthread_exit - terminate calling thread	//终止调用线程

SYNOPSIS
       #include <pthread.h>

       void pthread_exit(void *retval);

       Compile and link with -pthread.	//编译和链接时需要加 -pthread

DESCRIPTION
       The pthread_exit() function terminates the calling thread and returns a value via retval that (if the thread is joinable) is available to another thread in the same process that calls pthread_join(3).
	   /*pthread_exit() 函数终止调用线程并通过 retval 返回一个值(如果线程是可连接的)可以在同一进程的其他线程中调用  pthread_join(3) 函数来获得这个状态值。*/

       Any clean-up handlers established by pthread_cleanup_push(3) that have not yet been popped, are popped (in the reverse of the order in which they were pushed) and executed. If the thread has any thread-specific data, then, after the clean-up handlers have been executed, the corresponding destructor functions are called, in an unspecified order.
	   /*由 pthread_cleanup_push(3) 建立的尚未弹出的任何清理处理程序将被弹出(与它们被推动的顺序相反)并执行。 如果线程具有任何特定于线程的数据,则在执行清理处理程序之后,将以未指定的顺序调用相应的析构函数。*/

       When a thread terminates, process-shared resources (e.g., mutexes, condition variables, semaphores, and file descriptors) are not released, and functions registered using atexit(3) are not called.
	   /*当线程终止时,不释放进程共享资源(例如,互斥锁,条件变量,信号量和文件描述符),并且不调用使用 atexit(3) 注册的函数。*/

       After the last thread in a process terminates, the process terminates as by calling exit(3) with an exit status of zero; thus, process-shared resources are released and functions registered using atexit(3) are called.
	   /*在进程中的最后一个线程终止后,进程终止,和调用退出状态为零的 exit(3) 一样; 因此,最后一个线程终止后会释放进程共享资源并调用使用 atexit(3) 注册的函数。*/

RETURN VALUE
       This function does not return to the caller.
	   /*无返回值*/

ERRORS
       This function always succeeds.

CONFORMING TO
       POSIX.1-2001.

NOTES
       Performing a return from the start function of any thread other than the main thread  results in an implicit call to pthread_exit(), using the function's return value as the thread's exit status.
	   /*执行从主线程以外的任何线程的 start 函数使用 return 将导致对 pthread_exit() 的隐式调用,使用函数的 return 返回值作为线程的退出状态。*/

       To allow other threads to continue execution, the main thread should terminate by calling pthread_exit() rather than exit(3).
	   /*要允许其他线程继续执行,主线程应该通过调用 pthread_exit() 而不是 exit(3) 来终止。*/

       The value pointed to by retval should not be located on the calling thread's stack, since the contents of that stack are undefined after the thread terminates.
	   /*retval 指向的值不应该位于调用线程的栈上,因为在线程终止后该栈的内容是未定义的。*/

BUGS
       Currently, there are limitations in the kernel implementation logic for wait(2)ing on a  stopped thread group with a dead thread group leader. This can manifest in problems such as a locked terminal if a stop signal is sent to a foreground process whose thread group leader has already called pthread_exit().
	   /*目前,在用于等待具有死线程组组长的已停止线程组的内核实现逻辑中存在限制。 如果将停止信号发送到其线程组负责人已经调用 pthread_exit() 的前台进程,则这可以表现为诸如锁定终端之类的问题。*/

SEE ALSO
       pthread_create(3), pthread_join(3), pthreads(7)

COLOPHON
       This page is part of release 3.35 of the Linux man-pages project.  A description of the project, and information about report‐
       ing bugs, can be found at http://man7.org/linux/man-pages/.



Linux                                                         2009-03-30                                              PTHREAD_EXIT(3)

猜你喜欢

转载自blog.csdn.net/wenfei11471/article/details/80947098
今日推荐