⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 posix.sgml

📁 eCos/RedBoot for勤研ARM AnywhereII(4510) 含全部源代码
💻 SGML
📖 第 1 页 / 共 4 页
字号:
int pthread_attr_setdetachstate(pthread_attr_t *attr,
                                int detachstate); 
int pthread_attr_getdetachstate(const pthread_attr_t *attr,
	                        int *detachstate); 
int pthread_attr_setstackaddr(pthread_attr_t *attr,
                              void *stackaddr); 
int pthread_attr_getstackaddr(const pthread_attr_t *attr,
	                      void **stackaddr); 
int pthread_attr_setstacksize(pthread_attr_t *attr,
                              size_t stacksize); 
int pthread_attr_getstacksize(const pthread_attr_t *attr,
	                      size_t *stacksize); 
int pthread_create( pthread_t *thread,
                    const pthread_attr_t *attr,
	            void *(*start_routine)(void *),
	            void *arg);
pthread_t pthread_self( void ); 
int pthread_equal(pthread_t thread1, pthread_t thread2); 
void pthread_exit(void *retval); 
int pthread_join(pthread_t thread, void **thread_return); 
int pthread_detach(pthread_t thread); 
int pthread_once(pthread_once_t *once_control,
	         void (*init_routine)(void));
</screen>

</sect2>

<!-- =================================================================== -->

<sect2>
<title>Functions Omitted</title>
	
<para>
&lt;none&gt;
</para>

</sect2>

<!-- =================================================================== -->

<sect2>
<title>Notes</title>

<itemizedlist>
  <listitem>
    <para>
    The presence of thread support as a whole is controlled by the the
    CYGPKG_POSIX_PTHREAD configuration option. Note that disabling
    this will also disable many other features of the POSIX package,
    since these are intimately bound up with the thread mechanism.
    </para>
  </listitem>
  
  <listitem>
    <para>
    The default (non-scheduling) thread attributes are:
    </para>
    <screen>
    detachstate            PTHREAD&lowbar;CREATE&lowbar;JOINABLE
    stackaddr              unset
    stacksize              unset
    </screen>
  </listitem>
  
  <listitem>
    <para>
      Dynamic thread stack allocation is only provided if there is an
      implementation of
      <emphasis>malloc()</emphasis> configured (i.e. a package
      implements the
      CYGINT&lowbar;MEMALLOC&lowbar;MALLOC&lowbar;ALLOCATORS
      interface). If there is no malloc() available, then the thread
      creator must supply a stack. If only a stack address is supplied
      then the stack is assumed to be PTHREAD&lowbar;STACK&lowbar;MIN
      bytes long. This size is seldom useful for any but the most
      trivial of threads.  If a different sized stack is used, both
      the stack address and stack size must be supplied.
    </para>
  </listitem>
  
  <listitem>
    <para>
      The value of PTHREAD&lowbar;THREADS&lowbar;MAX is supplied by
      the CYGNUM&lowbar;POSIX&lowbar;PTHREAD&lowbar;THREADS&lowbar;MAX
      option. This defines the maximum number of threads allowed. The
      POSIX standard requires this value to be at least 64, and this
      is the default value set.
    </para>
  </listitem>

  <listitem>
    <para>
    When the POSIX package is installed, the thread that calls 
    <emphasis>main()</emphasis> is initialized as a POSIX thread. The
    priority of that thread is controlled by the
    CYGNUM&lowbar;POSIX&lowbar;MAIN&lowbar;DEFAULT&lowbar;PRIORITY option.
    </para>
  </listitem>
</itemizedlist>

</sect2>
</sect1>

<!-- }}} -->
<!-- {{{ Thread-Specific Data -->

<sect1 id="posix-thread-specific-data">
<title>Thread-Specific Data &lsqb;POSIX Section 17&rsqb;</title>

<!-- =================================================================== -->

<sect2>
<title>Functions Implemented</title>

<screen>
int pthread&lowbar;key&lowbar;create(pthread&lowbar;key&lowbar;t &ast;key,
	               void (&ast;destructor)(void &ast;)); 
int pthread&lowbar;setspecific(pthread&lowbar;key&lowbar;t key, const void &ast;pointer); 
void &ast;pthread&lowbar;getspecific(pthread&lowbar;key&lowbar;t key); 
int pthread&lowbar;key&lowbar;delete(pthread&lowbar;key&lowbar;t key);
</screen>

</sect2>

<!-- =================================================================== -->

<sect2>
<title>Functions Omitted</title>
<para>
&lt;none&gt;
</para>
</sect2>

<!-- =================================================================== -->

<sect2>
<title>Notes</title>

<itemizedlist>
  <listitem>
    <para>
    The value of PTHREAD&lowbar;DESTRUCTOR&lowbar;ITERATIONS is
    provided by the
    CYGNUM&lowbar;POSIX&lowbar;PTHREAD&lowbar;DESTRUCTOR&lowbar;ITERATIONS
    option. This controls the number of times that a key destructor
    will be called while the data item remains non-NULL.
    </para>
  </listitem>
  
  <listitem>
    <para>
    The value of PTHREAD&lowbar;KEYS&lowbar;MAX is provided
    by the CYGNUM&lowbar;POSIX&lowbar;PTHREAD&lowbar;KEYS&lowbar;MAX
    option. This defines the maximum number of per-thread data items
    supported. The POSIX standard calls for this to be a minimum of
    128, which is rather large for an embedded system. The default
    value for this option is set to 128 for compatibility but it
    should be reduced to a more usable value.
    </para>
  </listitem>
</itemizedlist>

</sect2>
</sect1>

<!-- }}} -->
<!-- {{{ Thread Cancellation -->

<sect1 id="posix-thread-cancellation">
<title>Thread Cancellation &lsqb;POSIX Section 18&rsqb;</title>

<!-- =================================================================== -->

<sect2>
<title>Functions Implemented</title>

<screen>
int pthread&lowbar;cancel(pthread&lowbar;t thread); 
int pthread&lowbar;setcancelstate(int state, int &ast;oldstate); 
int pthread&lowbar;setcanceltype(int type, int &ast;oldtype); 
void pthread&lowbar;testcancel(void); 
void pthread&lowbar;cleanup&lowbar;push( void (&ast;routine)(void &ast;),
                           void &ast;arg); 
void pthread&lowbar;cleanup&lowbar;pop( int execute);
</screen>
</sect2>


<!-- =================================================================== -->

<sect2>
<title>Functions Omitted</title>
<para>
&lt;none&gt;
</para>
</sect2>

<!-- =================================================================== -->

<sect2>
<title>Notes</title>
<para>
Asynchronous cancellation is only partially implemented.  In
particular, cancellation may occur in unexpected places in some
functions. It is strongly recommended that only synchronous
cancellation be used. 
</para>
</sect2>
</sect1>

<!-- }}} -->
<!-- {{{ Non-POSIX Functions -->

<sect1 id="posix-non-posix-functions">
<title>Non-POSIX Functions</title>
	
<para>
In addition to the standard POSIX functions defined above, the
following non-POSIX functions are defined in the FILEIO package.
</para>

<!-- =================================================================== -->

<sect2>
<title>General I&sol;O Functions</title>
<screen>
int ioctl( int fd, CYG&lowbar;ADDRWORD com, CYG&lowbar;ADDRWORD data ); 
int select( int nfd, fd&lowbar;set &ast;in, fd&lowbar;set &ast;out, fd&lowbar;set &ast;ex, struct timeval &ast;tv);
</screen>
</sect2>


<!-- =================================================================== -->

<sect2>
<title>Socket Functions</title>
<screen>
int socket( int domain, int type, int protocol); 
int bind( int s, const struct sockaddr &ast;sa, unsigned int len); 
int listen( int s, int len); 
int accept( int s, struct sockaddr &ast;sa, socklen&lowbar;t &ast;addrlen); 
int connect( int s, const struct sockaddr &ast;sa, socklen&lowbar;t len); 
int getpeername( int s, struct sockaddr &ast;sa, socklen&lowbar;t &ast;len); 
int getsockname( int s, struct sockaddr &ast;sa, socklen&lowbar;t &ast;len); 
int setsockopt( int s, int level, int optname, const void &ast;optval,
	        socklen&lowbar;t optlen); 
int getsockopt( int s, int level, int optname, void &ast;optval,
	        socklen&lowbar;t &ast;optlen); 
ssize&lowbar;t recvmsg( int s, struct msghdr &ast;msg, int flags); 
ssize&lowbar;t recvfrom( int s, void &ast;buf, size&lowbar;t len, int flags, 
	          struct sockaddr &ast;from, socklen&lowbar;t &ast;fromlen); 
ssize&lowbar;t recv( int s, void &ast;buf, size&lowbar;t len, int flags); 
ssize&lowbar;t sendmsg( int s, const struct msghdr &ast;msg, int flags); 
ssize&lowbar;t sendto( int s, const void &ast;buf, size&lowbar;t len, int flags, 
	        const struct sockaddr &ast;to, socklen&lowbar;t tolen); 
ssize&lowbar;t send( int s, const void &ast;buf, size&lowbar;t len, int flags); 
int shutdown( int s, int how);
</screen>
</sect2>

<!-- =================================================================== -->

<sect2>
<title>Notes</title>
<itemizedlist>
  <listitem>
   <para>
   The precise behaviour of these functions depends mainly on the
   functionality of the underlying filesystem or network stack to
   which they are applied.
   </para>
  </listitem>
</itemizedlist>
</sect2>
</sect1>

<!-- }}} -->

</chapter>

<!-- {{{ Bibliography -->

<bibliography id="posix-references-and-bibliography">
<title>References and Bibliography</title>

    <bibliomixed>
      <bibliomisc>&lsqb;Lewine&rsqb;</bibliomisc>
      <author>
	<firstname>Donald</firstname>
	<othername>A.</othername>
	<surname>Lweine</surname>
      </author>
      <title>Posix Programmer&rsquo;s Guide: Writing Portable Unix
	Programs With the POSIX.1 Standard O&rsquo;Reilly &amp;
	Associates; ISBN: 0937175730.</title></bibliomixed>

    <bibliomixed>
      <bibliomisc>&lsqb;Lewis1&rsqb;</bibliomisc>
      <author>
	<firstname>Bil</firstname>
	<surname>Lewis</surname>
      </author>
      <author>
	<firstname>Daniel</firstname>
	<othername>J.</othername>
	<surname>Berg</surname>
      </author>
      <title>Threads Primer: A Guide to Multithreaded Programming</title>
      <publishername>Prentice Hall</publishername>
      <isbn>ISBN: 013443698</isbn>
    </bibliomixed>

    <bibliomixed>
      <bibliomisc>&lsqb;Lewis2&rsqb;</bibliomisc>
      <author>
	<firstname>Bil</firstname>
	<surname>Lewis</surname>
      </author>
      <author>
	<firstname>Daniel</firstname>
	<othername>J.</othername>
	<surname>Berg</surname>
      </author>
      <title>Multithreaded Programming With Pthreads</title>
      <publisher>
	<publishername>Prentice Hall Computer Books</publishername>
      </publisher>
      <isbn>ISBN: 0136807291</isbn>
    </bibliomixed>

    <bibliomixed>
      <bibliomisc>&lsqb;Nichols&rsqb;</bibliomisc>
      <author>
	<firstname>Bradford</firstname>
	<surname>Nichols</surname>
      </author>
      <author>
	<firstname>Dick</firstname>
	<surname>Buttlar</surname>
      </author>
      <author>
	<firstname>Jacqueline</firstname>
	<othername>Proulx</othername>
	<surname>Farrell</surname>
      </author>
      <title>Pthreads Programming: A POSIX Standard for Better
	Multiprocessing (O&rsquo;Reilly Nutshell)</title>
      <publisher><publishername>O&rsquo;Reilly &amp; Associates</publishername>
      </publisher>
      <isbn>ISBN: 1565921151</isbn>
    </bibliomixed>

    <bibliomixed>
      <bibliomisc>&lsqb;Norton&rsqb;</bibliomisc>
      <author>
	<firstname>Scott</firstname>
	<othername>J.</othername>
	<surname>Norton</surname>
      </author>
      <author>
	<firstname>Mark</firstname>
	<othername>D.</othername>
	<surname>Depasquale</surname>
      </author>
      <title>Thread Time: The MultiThreaded Programming Guide</title>
      <publisher><publishername>Prentice Hall</publishername>
      </publisher>
      <isbn>ISBN: 0131900676</isbn></bibliomixed>


    <bibliomixed>
      <bibliomisc>&lsqb;POSIX&rsqb;</bibliomisc>
      <title>Portable Operating System Interface(POSIX) -
Part 1: System Application Programming Interface (API)&lsqb;C
Language&rsqb;</title>
      <corpauthor>ISO&sol;IEC 9945-1:1996, IEEE</corpauthor></bibliomixed>

    <bibliomixed>
      <bibliomisc>&lsqb;SUS2&rsqb;</bibliomisc>
      <title>Open Group; Single Unix Specification, Version 2</title>
      <bibliomisc><ulink
      url="http://www.opengroup.org/public/pubs/online/7908799/index.html">http://www.opengroup.org/public/pubs/online/7908799/index.html</ulink></bibliomisc>
    </bibliomixed>

  </bibliography>

<!-- }}} -->

</part>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -