OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libpthread/] [linuxthreads/] [sysdeps/] [pthread/] [bits/] [pthreadtypes.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Linuxthreads - a simple clone()-based implementation of Posix        */
2
/* threads for Linux.                                                   */
3
/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr)              */
4
/*                                                                      */
5
/* This program is free software; you can redistribute it and/or        */
6
/* modify it under the terms of the GNU Library General Public License  */
7
/* as published by the Free Software Foundation; either version 2       */
8
/* of the License, or (at your option) any later version.               */
9
/*                                                                      */
10
/* This program is distributed in the hope that it will be useful,      */
11
/* but WITHOUT ANY WARRANTY; without even the implied warranty of       */
12
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        */
13
/* GNU Library General Public License for more details.                 */
14
 
15
#if !defined _BITS_TYPES_H && !defined _PTHREAD_H
16
# error "Never include <bits/pthreadtypes.h> directly; use <sys/types.h> instead."
17
#endif
18
 
19
#ifndef _BITS_PTHREADTYPES_H
20
#define _BITS_PTHREADTYPES_H    1
21
 
22
#define __need_schedparam
23
#include <bits/sched.h>
24
 
25
/* Fast locks (not abstract because mutexes and conditions aren't abstract). */
26
struct _pthread_fastlock
27
{
28
  long int __status;            /* "Free" or "taken" or head of waiting list */
29
  int __spinlock;               /* For compare-and-swap emulation */
30
};
31
 
32
#ifndef _PTHREAD_DESCR_DEFINED
33
/* Thread descriptors */
34
typedef struct _pthread_descr_struct *_pthread_descr;
35
# define _PTHREAD_DESCR_DEFINED
36
#endif
37
 
38
 
39
/* Attributes for threads.  */
40
typedef struct
41
{
42
  int __detachstate;
43
  int __schedpolicy;
44
  struct __sched_param __schedparam;
45
  int __inheritsched;
46
  int __scope;
47
  size_t __guardsize;
48
  int __stackaddr_set;
49
  void *__stackaddr;
50
  size_t __stacksize;
51
} pthread_attr_t;
52
 
53
 
54
/* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */
55
typedef struct
56
{
57
  struct _pthread_fastlock __c_lock; /* Protect against concurrent access */
58
  _pthread_descr __c_waiting;        /* Threads waiting on this condition */
59
} pthread_cond_t;
60
 
61
 
62
/* Attribute for conditionally variables.  */
63
typedef struct
64
{
65
  int __dummy;
66
} pthread_condattr_t;
67
 
68
/* Keys for thread-specific data */
69
typedef unsigned int pthread_key_t;
70
 
71
 
72
/* Mutexes (not abstract because of PTHREAD_MUTEX_INITIALIZER).  */
73
/* (The layout is unnatural to maintain binary compatibility
74
    with earlier releases of LinuxThreads.) */
75
typedef struct
76
{
77
  int __m_reserved;               /* Reserved for future use */
78
  int __m_count;                  /* Depth of recursive locking */
79
  _pthread_descr __m_owner;       /* Owner thread (if recursive or errcheck) */
80
  int __m_kind;                   /* Mutex kind: fast, recursive or errcheck */
81
  struct _pthread_fastlock __m_lock; /* Underlying fast lock */
82
} pthread_mutex_t;
83
 
84
 
85
/* Attribute for mutex.  */
86
typedef struct
87
{
88
  int __mutexkind;
89
} pthread_mutexattr_t;
90
 
91
 
92
/* Once-only execution */
93
typedef int pthread_once_t;
94
 
95
 
96
#ifdef __USE_UNIX98
97
/* Read-write locks.  */
98
typedef struct _pthread_rwlock_t
99
{
100
  struct _pthread_fastlock __rw_lock; /* Lock to guarantee mutual exclusion */
101
  int __rw_readers;                   /* Number of readers */
102
  _pthread_descr __rw_writer;         /* Identity of writer, or NULL if none */
103
  _pthread_descr __rw_read_waiting;   /* Threads waiting for reading */
104
  _pthread_descr __rw_write_waiting;  /* Threads waiting for writing */
105
  int __rw_kind;                      /* Reader/Writer preference selection */
106
  int __rw_pshared;                   /* Shared between processes or not */
107
} pthread_rwlock_t;
108
 
109
 
110
/* Attribute for read-write locks.  */
111
typedef struct
112
{
113
  int __lockkind;
114
  int __pshared;
115
} pthread_rwlockattr_t;
116
#endif
117
 
118
 
119
/* Thread identifiers */
120
typedef unsigned long int pthread_t;
121
 
122
#endif  /* bits/pthreadtypes.h */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.