1 #ifndef CYGONCE_POSIX_MUTTYPES_H
2 #define CYGONCE_POSIX_MUTTYPES_H
3 //=============================================================================
7 // POSIX mutex types header
9 //=============================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15 // eCos is free software; you can redistribute it and/or modify it under
16 // the terms of the GNU General Public License as published by the Free
17 // Software Foundation; either version 2 or (at your option) any later version.
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
38 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39 // at http://sources.redhat.com/ecos/ecos-license/
40 // -------------------------------------------
41 //####ECOSGPLCOPYRIGHTEND####
42 //=============================================================================
43 //#####DESCRIPTIONBEGIN####
46 // Contributors: nickg,jlarmour
48 // Purpose: POSIX types header
49 // Description: This header contains POSIX type definitions for mutexes
50 // and cond vars. These types are implementation defined.
52 // Usage: #include <sys/types.h>
55 //####DESCRIPTIONEND####
57 //=============================================================================
59 #include <pkgconf/posix.h>
60 #include <pkgconf/kernel.h>
62 #include <cyg/infra/cyg_type.h>
64 //-----------------------------------------------------------------------------
66 // This structure must exactly correspond in size and layout to the underlying
67 // eCos C++ class that implements this object. Because we have to support
68 // PTHREAD_MUTEX_INITIALIZER we cannot abstract this object very easily.
76 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
77 CYG_WORD32 protocol; // this mutex's protocol
80 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
81 CYG_WORD32 ceiling; // mutex priority ceiling
86 #if defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC) &&\
87 defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING)
88 #define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0, 0, 0 }
89 #elif defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC) ||\
90 defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING)
91 #define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0, 0 }
93 #define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0 }
96 //-----------------------------------------------------------------------------
97 // Mutex attributes structure
102 #ifdef _POSIX_THREAD_PRIO_PROTECT
105 } pthread_mutexattr_t;
107 // Values for protocol
108 #define PTHREAD_PRIO_NONE 1
109 #if defined(_POSIX_THREAD_PRIO_INHERIT)
110 #define PTHREAD_PRIO_INHERIT 2
112 #if defined(_POSIX_THREAD_PRIO_PROTECT)
113 #define PTHREAD_PRIO_PROTECT 3
116 //-----------------------------------------------------------------------------
117 // Condition Variable structure.
118 // Like mutexes, this must match the underlying eCos implementation class.
126 #define PTHREAD_COND_INITIALIZER { 0, 0 }
128 //-----------------------------------------------------------------------------
129 // Condition variable attributes structure
134 } pthread_condattr_t;
136 //-----------------------------------------------------------------------------
137 #endif // ifndef CYGONCE_POSIX_MUTTYPES_H