pthread_attr.h
Upload User: tsgydb
Upload Date: 2007-04-14
Package Size: 10674k
Code Size: 4k
Category:

MySQL

Development Platform:

Visual C++

  1. /* ==== pthread_attr.h ========================================================
  2.  * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *  This product includes software developed by Chris Provenzano.
  16.  * 4. The name of Chris Provenzano may not be used to endorse or promote 
  17.  *   products derived from this software without specific prior written
  18.  *   permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
  21.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED.  IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY 
  24.  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  25.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
  26.  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  27.  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
  28.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
  30.  * SUCH DAMAGE.
  31.  *
  32.  * $Id$
  33.  *
  34.  * Description : Basic pthread attributes header.
  35.  *
  36.  *  1.00 93/11/03 proven
  37.  *      -Started coding this file.
  38.  */
  39. #define _POSIX_THREAD_ATTR_STACKSIZE
  40. #define PTHREAD_STACK_DEFAULT 65536
  41. /* flags */
  42. #define PTHREAD_DETACHED 0x1
  43. #define PTHREAD_SCOPE_SYSTEM 0x2
  44. #define PTHREAD_INHERIT_SCHED 0x4
  45. #define PTHREAD_NOFLOAT 0x8
  46. #define PTHREAD_CREATE_DETACHED PTHREAD_DETACHED
  47. #define PTHREAD_CREATE_JOINABLE 0
  48. #define PTHREAD_SCOPE_PROCESS 0
  49. #define PTHREAD_EXPLICIT_SCHED 0
  50. /*
  51.  * New pthread attribute types.
  52.  */
  53. enum schedparam_policy {
  54. SCHED_RR,
  55. SCHED_IO,
  56. SCHED_FIFO,
  57. SCHED_OTHER
  58. };
  59. struct pthread_attr {
  60. enum schedparam_policy schedparam_policy;
  61. int sched_priority;
  62. int flags;
  63. void * arg_attr;
  64. void  (*cleanup_attr)();
  65. void * stackaddr_attr;
  66. size_t stacksize_attr;
  67. };
  68. struct sched_param {
  69. int sched_priority;
  70. void * no_data;
  71. };
  72. /*
  73.  * New functions
  74.  */
  75. __BEGIN_DECLS
  76. #if defined(DCE_COMPAT)
  77. typedef struct pthread_attr * pthread_attr_t;
  78. int pthread_attr_create __P_((pthread_attr_t *));
  79. int pthread_attr_delete __P_((pthread_attr_t *));
  80. #else
  81. typedef struct pthread_attr pthread_attr_t;
  82. int pthread_attr_init __P_((pthread_attr_t *));
  83. int pthread_attr_destroy __P_((pthread_attr_t *));
  84. int pthread_attr_setstacksize __P_((pthread_attr_t *, size_t));
  85. int pthread_attr_getstacksize __P_((pthread_attr_t *, size_t *));
  86. int pthread_attr_setstackaddr __P_((pthread_attr_t *, void *));
  87. int pthread_attr_getstackaddr __P_((pthread_attr_t *, void **));
  88. int pthread_attr_setdetachstate __P_((pthread_attr_t *, int ));
  89. int pthread_attr_getdetachstate __P_((pthread_attr_t *, int *));
  90. int pthread_attr_setscope __P_((pthread_attr_t *, int ));
  91. int pthread_attr_getscope __P_((pthread_attr_t *, int *));
  92. int pthread_attr_setinheritsched __P_((pthread_attr_t *, int ));
  93. int pthread_attr_getinheritsched __P_((pthread_attr_t *, int *));
  94. int pthread_attr_setschedpolicy __P_((pthread_attr_t *, int ));
  95. int pthread_attr_getschedpolicy __P_((pthread_attr_t *, int *));
  96. int pthread_attr_setschedparam  __P_((pthread_attr_t *, struct sched_param *));
  97. int pthread_attr_getschedparam  __P_((pthread_attr_t *, struct sched_param *));
  98. int pthread_attr_setfloatstate __P_((pthread_attr_t *, int ));
  99. int pthread_attr_getfloatstate __P_((pthread_attr_t *, int *));
  100. int pthread_attr_setcleanup __P_((pthread_attr_t *, void (*routine)(void *),
  101.   void *));
  102. #endif
  103. __END_DECLS