pthread_setschedparam.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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_SETSCHEDPARAM(3) manual page</TITLE>
  6. <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.4 (Linux)">
  7. <META NAME="CREATED" CONTENT="20050504;18110100">
  8. <META NAME="CHANGEDBY" CONTENT="Ross Johnson">
  9. <META NAME="CHANGED" CONTENT="20080630;22330400">
  10. <!-- manual page source format generated by PolyglotMan v3.2, -->
  11. <!-- available at http://polyglotman.sourceforge.net/ -->
  12. </HEAD>
  13. <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR">
  14. <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4>
  15. <P><A HREF="index.html">Reference Index</A></P>
  16. <P><A HREF="#toc">Table of Contents</A></P>
  17. <H2><A HREF="#toc0" NAME="sect0">Name</A></H2>
  18. <P>pthread_setschedparam, pthread_getschedparam - control thread
  19. scheduling
  20. </P>
  21. <P>parameters
  22. </P>
  23. <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2>
  24. <P><B>#include &lt;pthread.h&gt;</B>
  25. </P>
  26. <P><B>int pthread_setschedparam(pthread_t </B><I>target_thread</I><B>,
  27. int </B><I>policy</I><B>, const struct sched_param *</B><I>param</I><B>);</B>
  28. </P>
  29. <P><B>int pthread_getschedparam(pthread_t </B><I>target_thread</I><B>,
  30. int *</B><I>policy</I><B>, struct sched_param *</B><I>param</I><B>);</B>
  31. </P>
  32. <H2><A HREF="#toc2" NAME="sect2">Description</A></H2>
  33. <P><B>pthread_setschedparam</B> sets the scheduling parameters for
  34. the thread <I>target_thread</I> as indicated by <I>policy</I> and
  35. <I>param</I>. <I>policy</I> can be either <B>SCHED_OTHER</B>
  36. (regular, non-real-time scheduling), <B>SCHED_RR</B> (real-time,
  37. round-robin) or <B>SCHED_FIFO</B> (real-time, first-in first-out).
  38. <I>param</I> specifies the scheduling priority for the two real-time
  39. policies.</P>
  40. <P><B>Pthreads-w32</B> only supports SCHED_OTHER and does not support
  41. the real-time scheduling policies <B>SCHED_RR</B> and <B>SCHED_FIFO.</B>
  42. </P>
  43. <P><B>pthread_getschedparam</B> retrieves the scheduling policy and
  44. scheduling parameters for the thread <I>target_thread</I> and stores
  45. them in the locations pointed to by <I>policy</I> and <I>param</I>,
  46. respectively.
  47. </P>
  48. <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2>
  49. <P><B>pthread_setschedparam</B> and <B>pthread_getschedparam</B>
  50. return 0 on success and a non-zero error code on error.
  51. </P>
  52. <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2>
  53. <P>On error, <B>pthread_setschedparam</B> returns the following error
  54. codes:
  55. </P>
  56. <DL>
  57. <DL>
  58. <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ENOTSUP</B>
  59. </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm">
  60. <I>policy</I> is not <B>SCHED_OTHER.</B></DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm">
  61. <B>EINVAL</B>
  62. </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm">
  63. One of the arguments is invalid, or the priority value specified by
  64. <I>param</I> is not valid for the specified policy.</DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm">
  65. <B>ESRCH</B>
  66. </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm">
  67. The <I>target_thread</I> is invalid or has already terminated
  68. </DD></DL>
  69. </DL>
  70. <P>
  71. On error, <B>pthread_getschedparam</B> returns the following error
  72. codes:
  73. </P>
  74. <DL>
  75. <DL>
  76. <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ESRCH</B>
  77. </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm">
  78. the <I>target_thread</I> is invalid or has already terminated
  79. </DD></DL>
  80. </DL>
  81. <H2>
  82. <A HREF="#toc5" NAME="sect5">Author</A></H2>
  83. <P>Xavier Leroy &lt;[email protected]&gt;
  84. </P>
  85. <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P>
  86. <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2>
  87. <P><A HREF="sched_setscheduler.html"><B>sched_setscheduler</B>(2)</A>
  88. , <A HREF="sched_getscheduler.html"><B>sched_getscheduler</B>(2)</A>
  89. , <A HREF="sched_getparam.html"><B>sched_getparam</B>(2)</A> ,
  90. <A HREF="pthread_attr_init.html"><B>pthread_attr_setschedpolicy</B>(3)</A>
  91. , <A HREF="pthread_attr_init.html"><B>pthread_attr_setschedparam</B>(3)</A>
  92. .
  93. </P>
  94. <HR>
  95. <P><A NAME="toc"></A><B>Table of Contents</B></P>
  96. <UL>
  97. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A>
  98. </P>
  99. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A>
  100. </P>
  101. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A>
  102. </P>
  103. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return
  104. Value</A>
  105. </P>
  106. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A>
  107. </P>
  108. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A>
  109. </P>
  110. <LI><P><A HREF="#sect6" NAME="toc6">See Also</A>
  111. </P>
  112. </UL>
  113. </BODY>
  114. </HTML>