pthread_create.html 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
  5. <TITLE>PTHREAD_CREATE(3) manual page</TITLE>
  6. <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)">
  7. <META NAME="CREATED" CONTENT="20050504;19394700">
  8. <META NAME="CHANGED" CONTENT="20050504;20140200">
  9. <!-- manual page source format generated by PolyglotMan v3.2, -->
  10. <!-- available at http://polyglotman.sourceforge.net/ -->
  11. </HEAD>
  12. <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR">
  13. <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4>
  14. <P><A HREF="index.html">Reference Index</A></P>
  15. <P><A HREF="#toc">Table of Contents</A></P>
  16. <H2><A HREF="#toc0" NAME="sect0">Name</A></H2>
  17. <P>pthread_create - create a new thread
  18. </P>
  19. <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2>
  20. <P><B>#include &lt;pthread.h&gt;</B>
  21. </P>
  22. <P><B>int pthread_create(pthread_t * </B><I>thread</I><B>,
  23. pthread_attr_t * </B><I>attr</I><B>, void * (*</B><I>start_routine</I><B>)(void
  24. *), void * </B><I>arg</I><B>);</B>
  25. </P>
  26. <H2><A HREF="#toc2" NAME="sect2">Description</A></H2>
  27. <P><B>pthread_create</B> creates a new thread of control that
  28. executes concurrently with the calling thread. The new thread applies
  29. the function <I>start_routine</I> passing it <I>arg</I> as first
  30. argument. The new thread terminates either explicitly, by calling
  31. <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> , or
  32. implicitly, by returning from the <I>start_routine</I> function. The
  33. latter case is equivalent to calling <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A>
  34. with the result returned by <I>start_routine</I> as exit code.
  35. </P>
  36. <P>The initial signal state of the new thread is inherited from it's
  37. creating thread and there are no pending signals. <B>Pthreads-w32</B>
  38. does not yet implement signals.</P>
  39. <P>The <I>attr</I> argument specifies thread attributes to be applied
  40. to the new thread. See <A HREF="pthread_attr_init.html"><B>pthread_attr_init</B>(3)</A>
  41. for a complete list of thread attributes. The <I>attr</I> argument
  42. can also be <B>NULL</B>, in which case default attributes are used:
  43. the created thread is joinable (not detached) and has default (non
  44. real-time) scheduling policy.
  45. </P>
  46. <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2>
  47. <P>On success, the identifier of the newly created thread is stored
  48. in the location pointed by the <I>thread</I> argument, and a 0 is
  49. returned. On error, a non-zero error code is returned.
  50. </P>
  51. <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2>
  52. <DL>
  53. <DT><B>EAGAIN</B>
  54. </DT><DL>
  55. <DL>
  56. <DT>
  57. Not enough system resources to create a process for the new
  58. thread, or<BR>more than <B>PTHREAD_THREADS_MAX</B> threads are
  59. already active.
  60. </DT></DL>
  61. </DL>
  62. </DL>
  63. <H2>
  64. <A HREF="#toc5" NAME="sect5">Author</A></H2>
  65. <P>Xavier Leroy &lt;[email protected]&gt;
  66. </P>
  67. <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P>
  68. <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2>
  69. <P><A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> ,
  70. <A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> ,
  71. <A HREF="pthread_detach.html"><B>pthread_detach</B>(3)</A> ,
  72. <A HREF="pthread_attr_init.html"><B>pthread_attr_init</B>(3)</A> .
  73. </P>
  74. <HR>
  75. <P><A NAME="toc"></A><B>Table of Contents</B></P>
  76. <UL>
  77. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A>
  78. </P>
  79. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A>
  80. </P>
  81. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A>
  82. </P>
  83. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return
  84. Value</A>
  85. </P>
  86. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A>
  87. </P>
  88. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A>
  89. </P>
  90. <LI><P><A HREF="#sect6" NAME="toc6">See Also</A>
  91. </P>
  92. </UL>
  93. </BODY>
  94. </HTML>