epoc32/include/stdapis/pthread.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
/*
williamr@2
     2
* ==============================================================================
williamr@2
     3
*  Name        : pthread.h
williamr@2
     4
*  Part of     : pthread
williamr@2
     5
*  Interface   : POSIX, pthread
williamr@2
     6
*  Description : POSIX thread exported header file 
williamr@2
     7
*  Version     : 
williamr@2
     8
williamr@2
     9
Copyright © 2005-2006 Nokia Corporation
williamr@2
    10
All rights reserved.
williamr@2
    11
* © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
williamr@2
    12
Redistribution and use in source and binary forms, with or without 
williamr@2
    13
modification, are permitted provided that the following conditions are met:
williamr@2
    14
 * Redistributions of source code must retain the above copyright notice, this 
williamr@2
    15
   list of conditions and the following disclaimer. 
williamr@2
    16
 * Redistributions in binary form must reproduce the above copyright notice, 
williamr@2
    17
   this list of conditions and the following disclaimer in the documentation 
williamr@2
    18
   and/or other materials provided with the distribution. 
williamr@2
    19
 * Neither the name of the <ORGANIZATION> nor the names of its contributors 
williamr@2
    20
   may be used to endorse or promote products derived from this software 
williamr@2
    21
   without specific prior written permission. 
williamr@2
    22
   
williamr@2
    23
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
williamr@2
    24
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
williamr@2
    25
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
williamr@2
    26
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
williamr@2
    27
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
williamr@2
    28
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
williamr@2
    29
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
williamr@2
    30
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
williamr@2
    31
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
williamr@2
    32
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
williamr@2
    33
* ==============================================================================
williamr@2
    34
*/
williamr@2
    35
#ifndef  PTHREAD_H
williamr@2
    36
#define  PTHREAD_H
williamr@2
    37
williamr@2
    38
#include <pthreadtypes.h>
williamr@2
    39
#include <sched.h>
williamr@2
    40
#include <e32def.h>
williamr@2
    41
#include <stddef.h>
williamr@2
    42
#include <time.h>
williamr@2
    43
#include <limits.h>
williamr@2
    44
#include <pthreadalias.h>
williamr@2
    45
williamr@2
    46
#define POSIX_THREAD_DESTRUCTOR_ITERATIONS  4
williamr@2
    47
#define POSIX_THREAD_KEYS_MAX               128
williamr@2
    48
#define PTHREAD_STACK_MIN                   0x2000
williamr@2
    49
#define POSIX_THREAD_THREADS_MAX            64
williamr@2
    50
#define PTHREAD_THREADS_MAX                 1024
williamr@2
    51
#define POSIX_SEM_NSEMS_MAX                 256
williamr@2
    52
#define SEM_NSEMS_MAX                       1024
williamr@2
    53
#define _POSIX_SEM_VALUE_MAX                32767
williamr@2
    54
#define SEM_VALUE_MAX                       INT_MAX
williamr@2
    55
williamr@2
    56
/* internal use*/
williamr@2
    57
typedef enum 
williamr@2
    58
{
williamr@2
    59
    _ENeedsNormalInit =-3,
williamr@2
    60
    _ENeedsRecursiveInit,
williamr@2
    61
    _ENeedsErrorCheckInit,
williamr@2
    62
    _EInitialized =1,
williamr@2
    63
    _EDestroyed,
williamr@2
    64
    _EInvalid,
williamr@2
    65
}_handle_state;
williamr@2
    66
williamr@2
    67
enum _LockStatus
williamr@2
    68
{
williamr@2
    69
    _ELockNotCreated,
williamr@2
    70
    _ELockCreating,
williamr@2
    71
    _ELockCreated,
williamr@2
    72
};
williamr@2
    73
williamr@2
    74
enum _OnceStatus
williamr@2
    75
{
williamr@2
    76
    _ENotDone,
williamr@2
    77
    _EDoing,
williamr@2
    78
    _EDone,
williamr@2
    79
};
williamr@2
    80
williamr@2
    81
typedef int pthread_once_t;
williamr@2
    82
williamr@2
    83
struct _pthread_mutex_t;
williamr@2
    84
typedef struct 
williamr@2
    85
{
williamr@2
    86
    _handle_state  iState;
williamr@2
    87
    struct _pthread_mutex_t* iPtr;
williamr@2
    88
    int   iReentry;
williamr@2
    89
}pthread_mutex_t;
williamr@2
    90
williamr@2
    91
typedef struct 
williamr@2
    92
{
williamr@2
    93
    _handle_state iState;
williamr@2
    94
    int iSharedType;
williamr@2
    95
    int iMutexType;
williamr@2
    96
}pthread_mutexattr_t;
williamr@2
    97
williamr@2
    98
williamr@2
    99
struct _CondNode;
williamr@2
   100
struct _CondQueue
williamr@2
   101
{
williamr@2
   102
  struct _CondNode*       iHead;
williamr@2
   103
  struct _CondNode*       iTail;
williamr@2
   104
  pthread_mutex_t iMutex;
williamr@2
   105
};
williamr@2
   106
williamr@2
   107
typedef struct 
williamr@2
   108
{
williamr@2
   109
  _handle_state    iState;
williamr@2
   110
  struct _CondQueue       iQueue;
williamr@2
   111
}pthread_cond_t;
williamr@2
   112
williamr@2
   113
typedef struct _pthread_condattr_t*   pthread_condattr_t;
williamr@2
   114
williamr@2
   115
#define PTHREAD_ONCE_INIT _ENotDone
williamr@2
   116
williamr@2
   117
#define PTHREAD_MUTEX_INITIALIZER { _ENeedsNormalInit, NULL,0 }
williamr@2
   118
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP { _ENeedsRecursiveInit, NULL, 0 }
williamr@2
   119
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP { _ENeedsErrorCheckInit, NULL,0 }
williamr@2
   120
williamr@2
   121
#define PTHREAD_COND_INITIALIZER { _ENeedsNormalInit, NULL,NULL }
williamr@2
   122
williamr@2
   123
enum 
williamr@2
   124
{ 
williamr@2
   125
    PTHREAD_CREATE_JOINABLE = 0,  /* Default */ 
williamr@2
   126
    PTHREAD_CREATE_DETACHED = 1
williamr@2
   127
};
williamr@2
   128
williamr@2
   129
enum 
williamr@2
   130
{ 
williamr@2
   131
    PTHREAD_SCOPE_SYSTEM  = 1  /* Default */
williamr@2
   132
};
williamr@2
   133
williamr@2
   134
enum 
williamr@2
   135
{  
williamr@2
   136
    PTHREAD_CANCEL_ASYNCHRONOUS = 0,  
williamr@2
   137
    PTHREAD_CANCEL_DEFERRED = 1  /* Default */
williamr@2
   138
};
williamr@2
   139
williamr@2
   140
enum 
williamr@2
   141
{  
williamr@2
   142
    PTHREAD_PROCESS_PRIVATE = 0,   
williamr@2
   143
};
williamr@2
   144
williamr@2
   145
enum
williamr@2
   146
{
williamr@2
   147
  PTHREAD_MUTEX_NORMAL,
williamr@2
   148
  PTHREAD_MUTEX_RECURSIVE,
williamr@2
   149
  PTHREAD_MUTEX_ERRORCHECK,
williamr@2
   150
  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
williamr@2
   151
};
williamr@2
   152
williamr@2
   153
williamr@2
   154
williamr@2
   155
#ifdef __cplusplus
williamr@2
   156
extern "C"
williamr@2
   157
{
williamr@2
   158
#endif    /* __cplusplus */
williamr@2
   159
williamr@2
   160
typedef void * (*thread_begin_routine)(void *);
williamr@2
   161
/*
williamr@2
   162
This function creates a thread, with attributes specified by attrib,
williamr@2
   163
within a process. If attrib is NULL, then default attributes will be used.
williamr@2
   164
On successful completion, pthread_create() will store the ID of the 
williamr@2
   165
created thread in the location referenced by threadhdl.
williamr@2
   166
*/ 
williamr@2
   167
IMPORT_C extern int pthread_create(pthread_t *threadhdl, pthread_attr_t *attrib, 
williamr@2
   168
                   thread_begin_routine begin_routine , void * param);  
williamr@2
   169
/*
williamr@2
   170
This function return the handle to current thread.
williamr@2
   171
*/                    
williamr@2
   172
IMPORT_C extern pthread_t pthread_self ();
williamr@2
   173
williamr@2
   174
/*
williamr@2
   175
Compare two thread handles
williamr@2
   176
*/
williamr@2
   177
IMPORT_C extern int pthread_equal(pthread_t t1,pthread_t t2);
williamr@2
   178
/*
williamr@2
   179
Waiting for thread termination
williamr@2
   180
*/
williamr@2
   181
IMPORT_C extern int pthread_join(pthread_t thHandle, void **retValPtr);
williamr@2
   182
/*
williamr@2
   183
detach from thread 
williamr@2
   184
*/
williamr@2
   185
IMPORT_C extern int pthread_detach(pthread_t thrHandle);
williamr@2
   186
/*
williamr@2
   187
exit current thread
williamr@2
   188
*/
williamr@2
   189
IMPORT_C extern void pthread_exit(void *retValPtr);
williamr@2
   190
/*
williamr@2
   191
Initialise the thread attributes
williamr@2
   192
*/
williamr@2
   193
IMPORT_C int pthread_attr_init(pthread_attr_t *attrib);
williamr@2
   194
/*
williamr@2
   195
Destroy the thread attributes
williamr@2
   196
*/
williamr@2
   197
IMPORT_C int pthread_attr_destroy(pthread_attr_t *attrib);
williamr@2
   198
/*
williamr@2
   199
Get the detach_state of the current thread
williamr@2
   200
*/
williamr@2
   201
IMPORT_C int pthread_attr_getdetachstate(const pthread_attr_t *attrib,
williamr@2
   202
                                         int *detState);
williamr@2
   203
/*
williamr@2
   204
Set the detach_state of the current thread
williamr@2
   205
*/                                         
williamr@2
   206
IMPORT_C int pthread_attr_setdetachstate(pthread_attr_t *attrib, 
williamr@2
   207
                                         int detState);                                         
williamr@2
   208
/*
williamr@2
   209
Get the stack size of the current thread
williamr@2
   210
*/
williamr@2
   211
IMPORT_C int pthread_attr_getstacksize(const pthread_attr_t *attrib,
williamr@2
   212
                                       size_t *stkSize);
williamr@2
   213
/*
williamr@2
   214
Set the stack size of the current thread
williamr@2
   215
*/                                       
williamr@2
   216
IMPORT_C int pthread_attr_setstacksize(pthread_attr_t *attrib, 
williamr@2
   217
                                       size_t stkSize);                                       
williamr@2
   218
williamr@2
   219
/*
williamr@2
   220
This function ensures that a piece of initialization code is executed at most once. 
williamr@2
   221
The once_control argument must point to a static  variable statically initialized to PTHREAD_ONCE_INIT
williamr@2
   222
williamr@2
   223
*/
williamr@2
   224
typedef void (*thread_init_routine) (void);
williamr@2
   225
IMPORT_C extern int pthread_once (pthread_once_t * once_control, 
williamr@2
   226
                                  thread_init_routine init_routine);
williamr@2
   227
williamr@2
   228
/*
williamr@2
   229
extern int pthread_key_create (pthread_key_t * key, void (*destructor) (void *));
williamr@2
   230
extern int pthread_key_delete (pthread_key_t key);
williamr@2
   231
extern int pthread_setspecific (pthread_key_t key, const void *value);
williamr@2
   232
extern void* pthread_getspecific (pthread_key_t key);
williamr@2
   233
*/
williamr@2
   234
williamr@2
   235
/*
williamr@2
   236
This function initializes the mutex attribute object attr and fills it with default values for the attributes.
williamr@2
   237
*/
williamr@2
   238
IMPORT_C extern int pthread_mutexattr_init (pthread_mutexattr_t * attr);
williamr@2
   239
williamr@2
   240
/*
williamr@2
   241
This function destroys the mutex attribute object attr and marks it as a destroyed object.
williamr@2
   242
*/
williamr@2
   243
IMPORT_C extern int pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
williamr@2
   244
williamr@2
   245
/*
williamr@2
   246
This function retrieves the current value of the process shared attribute in 
williamr@2
   247
attr and stores it in the location pointed to by pshared.
williamr@2
   248
*/
williamr@2
   249
IMPORT_C extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t* attr, int* pshared);
williamr@2
   250
williamr@2
   251
/*
williamr@2
   252
This function sets the current value of the process shared attribute in attr to the value specifed in the  
williamr@2
   253
pshared variable.
williamr@2
   254
*/
williamr@2
   255
IMPORT_C extern int pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, int pshared);
williamr@2
   256
williamr@2
   257
/*
williamr@2
   258
This function retrieves the current value of the mutex kind attribute in attr and 
williamr@2
   259
stores it in the location pointed to by type.
williamr@2
   260
*/
williamr@2
   261
IMPORT_C extern int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *type);
williamr@2
   262
williamr@2
   263
williamr@2
   264
/*
williamr@2
   265
This function sets the current value of the mutex kind attribute in attr to the value specifed in the  type variable.
williamr@2
   266
*/
williamr@2
   267
IMPORT_C extern int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int type);
williamr@2
   268
williamr@2
   269
/*
williamr@2
   270
This function initializes the mutex object pointed to by mutex according to the mutex attributes specified in attr. 
williamr@2
   271
If attr is NULL, default attributes are used instead.
williamr@2
   272
williamr@2
   273
*/
williamr@2
   274
IMPORT_C extern int pthread_mutex_init (pthread_mutex_t * mutex, const pthread_mutexattr_t * attr);
williamr@2
   275
williamr@2
   276
/*
williamr@2
   277
This function destroys the mutex object.  The mutex must be unlocked on entrance.
williamr@2
   278
This implementation requires even statically initialized mutexes to be explicitly destroyed.
williamr@2
   279
*/
williamr@2
   280
IMPORT_C extern int pthread_mutex_destroy (pthread_mutex_t * mutex);
williamr@2
   281
williamr@2
   282
/*
williamr@2
   283
This function locks the given mutex. If the mutex is currently
williamr@2
   284
unlocked, it becomes locked and owned by the calling thread, and
williamr@2
   285
this function  returns immediately. If the mutex is already
williamr@2
   286
locked by another thread, this function suspends the calling
williamr@2
   287
thread until the mutex is unlocked. 
williamr@2
   288
williamr@2
   289
If the mutex is already locked by the calling thread, the behavior of
williamr@2
   290
this function depends on the kind of the mutex. If the mutex is
williamr@2
   291
of the  PTHREAD_MUTEX_NORMAL or PTHREAD_MUTEX_DEFAULT kind, the calling thread is suspended until the mutex
williamr@2
   292
is unlocked, thus effectively causing the calling thread to
williamr@2
   293
deadlock. If the mutex is of the PTHREAD_MUTEX_ERRORCHECK kind,
williamr@2
   294
this function returns immediately with the error code EDEADLK.
williamr@2
   295
If the mutex is of the PTHREAD_MUTEX_RECURSIVE kind, this function
williamr@2
   296
succeeds and returns immediately, recording the number of times the
williamr@2
   297
calling thread has locked the mutex. An equal number of
williamr@2
   298
pthread_mutex_unlock operations must be performed before the mutex
williamr@2
   299
returns to the unlocked state.
williamr@2
   300
*/
williamr@2
   301
IMPORT_C extern int pthread_mutex_lock (pthread_mutex_t * mutex);
williamr@2
   302
williamr@2
   303
williamr@2
   304
/*
williamr@2
   305
This function behaves identically to pthread_mutex_lock, except that if it cannot acquire the lock before 
williamr@2
   306
the abs_timeout time, the call returns with the error code ETIMEDOUT. 
williamr@2
   307
*/
williamr@2
   308
IMPORT_C extern int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime);
williamr@2
   309
williamr@2
   310
/*
williamr@2
   311
This function behaves identically to pthread_mutex_lock, except that it does not 
williamr@2
   312
block the calling thread if the mutex is already locked by another thread (or by 
williamr@2
   313
the calling thread in the case of a PTHREAD_MUTEX_RECURSIVE mutex). Instead, pthread_mutex_trylock 
williamr@2
   314
returns immediately with the error code EAGAIN.
williamr@2
   315
*/
williamr@2
   316
IMPORT_C extern int pthread_mutex_trylock (pthread_mutex_t * mutex);
williamr@2
   317
williamr@2
   318
/*
williamr@2
   319
This function unlocks the given mutex. The mutex is assumed
williamr@2
   320
to be locked and owned by the calling thread on entrance to
williamr@2
   321
this function. If the mutex is of the PTHREAD_MUTEX_NORMAL or PTHREAD_MUTEX_DEFAULT kind,
williamr@2
   322
this function always returns it to the unlocked state. If it
williamr@2
   323
is of the PTHREAD_MUTEX_RECURSIVE kind, it decrements the locking count of the
williamr@2
   324
mutex (number of pthread_mutex_lock operations performed on it by
williamr@2
   325
the calling thread), and only when this count reaches zero is the
williamr@2
   326
mutex actually unlocked.
williamr@2
   327
williamr@2
   328
On PTHREAD_MUTEX_ERRORCHECK mutexes, this function actually checks
williamr@2
   329
at run-time that the mutex is locked on entrance, and that it was
williamr@2
   330
locked by the same thread that is now calling pthread_mutex_unlock.
williamr@2
   331
If these conditions are not met, an error code is returned and the
williamr@2
   332
mutex remains unchanged.  
williamr@2
   333
*/
williamr@2
   334
IMPORT_C extern int pthread_mutex_unlock (pthread_mutex_t * mutex);
williamr@2
   335
williamr@2
   336
/*
williamr@2
   337
This function initializes the condition attribute object attr and 
williamr@2
   338
sets it with default values for the attributes. 
williamr@2
   339
*/
williamr@2
   340
IMPORT_C extern int pthread_condattr_init (pthread_condattr_t * /*attr*/);
williamr@2
   341
williamr@2
   342
/*
williamr@2
   343
This function destroys the condtion variable attribute object.
williamr@2
   344
*/
williamr@2
   345
IMPORT_C extern int pthread_condattr_destroy (pthread_condattr_t * attr);
williamr@2
   346
/*
williamr@2
   347
extern int pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared);
williamr@2
   348
extern int pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared);
williamr@2
   349
*/
williamr@2
   350
williamr@2
   351
/*
williamr@2
   352
This function initializes the condition variable object pointed to by cond 
williamr@2
   353
using the attributes of the attr variable. If attr is NULL, default attributes 
williamr@2
   354
are used instead.
williamr@2
   355
*/
williamr@2
   356
IMPORT_C extern int pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * /*attr*/);
williamr@2
   357
williamr@2
   358
/*
williamr@2
   359
This function destroys the condition variable  object. 
williamr@2
   360
*/
williamr@2
   361
IMPORT_C extern int pthread_cond_destroy (pthread_cond_t * cond);
williamr@2
   362
williamr@2
   363
/*
williamr@2
   364
This function atomically unlocks mutex and waits on cond, 
williamr@2
   365
as pthread_cond_wait does, but it also bounds the duration 
williamr@2
   366
of the wait. If cond has not been signalled within the amount 
williamr@2
   367
of time specified by abstime, the mutex mutex is re-acquired and 
williamr@2
   368
pthread_cond_timedwait returns the error ETIMEDOUT. The abstime 
williamr@2
   369
parameter specifies an absolute time, with the same origin as time(2) and gettimeofday(2). 
williamr@2
   370
*/
williamr@2
   371
IMPORT_C extern int pthread_cond_timedwait (pthread_cond_t * cond,pthread_mutex_t * mutex,const struct timespec *abstime);
williamr@2
   372
williamr@2
   373
/*
williamr@2
   374
This function atomically unlocks the mutex (as per pthread_unlock_mutex) 
williamr@2
   375
and waits for the condition variable cond to be signalled. The thread 
williamr@2
   376
execution is suspended and does not consume any CPU time until the condition 
williamr@2
   377
variable is signalled. The mutex must be locked by the calling thread on entrance 
williamr@2
   378
to pthread_cond_wait. Before returning to the calling thread, pthread_cond_wait 
williamr@2
   379
re-acquires mutex (as per pthread_lock_mutex).
williamr@2
   380
*/
williamr@2
   381
IMPORT_C extern int pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex);
williamr@2
   382
williamr@2
   383
/*
williamr@2
   384
This function restarts one of the threads that are waiting on the condition 
williamr@2
   385
variable cond. If no threads are waiting on cond, nothing happens. If several 
williamr@2
   386
threads are waiting on cond, exactly one is restarted. 
williamr@2
   387
williamr@2
   388
*/
williamr@2
   389
IMPORT_C extern int pthread_cond_signal (pthread_cond_t * cond);
williamr@2
   390
williamr@2
   391
/*
williamr@2
   392
This function restarts all the threads that are waiting on the 
williamr@2
   393
condition variable cond. Nothing happens if no threads are waiting on cond. 
williamr@2
   394
*/
williamr@2
   395
IMPORT_C extern int pthread_cond_broadcast (pthread_cond_t * cond);
williamr@2
   396
williamr@2
   397
williamr@2
   398
typedef void (*destructor_routine)(void *);
williamr@2
   399
/*
williamr@2
   400
Thread-specific data key creation
williamr@2
   401
*/
williamr@2
   402
IMPORT_C int pthread_key_create(pthread_key_t *key, destructor_routine dest);
williamr@2
   403
williamr@2
   404
/*
williamr@2
   405
Thread-specific data key deletion
williamr@2
   406
*/
williamr@2
   407
IMPORT_C int pthread_key_delete(pthread_key_t key);
williamr@2
   408
williamr@2
   409
/*
williamr@2
   410
Setting Thread-specific data 
williamr@2
   411
*/
williamr@2
   412
IMPORT_C int pthread_setspecific(pthread_key_t key, const void *val);
williamr@2
   413
williamr@2
   414
/*
williamr@2
   415
Getting Thread-specific data 
williamr@2
   416
*/
williamr@2
   417
IMPORT_C void* pthread_getspecific(pthread_key_t key);
williamr@2
   418
williamr@2
   419
/*
williamr@2
   420
Getting contention scope 
williamr@2
   421
*/
williamr@2
   422
IMPORT_C int pthread_attr_getscope(const pthread_attr_t *attrib,
williamr@2
   423
                                   int* scope);
williamr@2
   424
/*
williamr@2
   425
Setting contention scope 
williamr@2
   426
*/
williamr@2
   427
IMPORT_C int pthread_attr_setscope(pthread_attr_t *attrib,int conscope); 
williamr@2
   428
williamr@2
   429
/*
williamr@2
   430
Setting scheduling policy
williamr@2
   431
*/
williamr@2
   432
IMPORT_C int pthread_attr_setschedpolicy(pthread_attr_t *attrib, 
williamr@2
   433
                                         int policy);                                  
williamr@2
   434
williamr@2
   435
/*
williamr@2
   436
Getting scheduling policy of the thread
williamr@2
   437
*/
williamr@2
   438
IMPORT_C int pthread_attr_getschedpolicy(const pthread_attr_t *attrib,
williamr@2
   439
                                         int *policy);
williamr@2
   440
williamr@2
   441
/*
williamr@2
   442
Getting scheduling param of the thread
williamr@2
   443
*/
williamr@2
   444
IMPORT_C int pthread_attr_getschedparam(const pthread_attr_t *attrib,
williamr@2
   445
                                        struct sched_param *param);
williamr@2
   446
williamr@2
   447
/*
williamr@2
   448
Setting scheduling param
williamr@2
   449
*/                                        
williamr@2
   450
IMPORT_C int pthread_attr_setschedparam(pthread_attr_t *attrib, 
williamr@2
   451
                                        const struct sched_param *param);
williamr@2
   452
williamr@2
   453
/*
williamr@2
   454
Getting dynamic scheduling param of the thread
williamr@2
   455
*/                                        
williamr@2
   456
IMPORT_C int pthread_getschedparam(pthread_t thr, int *policy,
williamr@2
   457
                                   struct sched_param *param);
williamr@2
   458
williamr@2
   459
/*
williamr@2
   460
Dynamically Setting scheduling params
williamr@2
   461
*/                                   
williamr@2
   462
IMPORT_C int pthread_setschedparam(pthread_t th, int policy, 
williamr@2
   463
                                   const struct sched_param *param);
williamr@2
   464
                                         
williamr@2
   465
#ifdef __cplusplus
williamr@2
   466
}                               /* End of  "C" */
williamr@2
   467
#endif                          /* __cplusplus */
williamr@2
   468
williamr@2
   469
williamr@2
   470
#endif /* PTHREAD_H */
williamr@2
   471