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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [compat/] [posix/] [current/] [include/] [mutex.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_POSIX_MUTEX_H
2
#define CYGONCE_POSIX_MUTEX_H
3
//=============================================================================
4
//
5
//      mutex.h
6
//
7
//      POSIX mutex and condition variable function definitions
8
//
9
//=============================================================================
10
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
11
// -------------------------------------------                              
12
// This file is part of eCos, the Embedded Configurable Operating System.   
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
//
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      
18
// version.                                                                 
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT      
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
23
// for more details.                                                        
24
//
25
// You should have received a copy of the GNU General Public License        
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
28
//
29
// As a special exception, if other files instantiate templates or use      
30
// macros or inline functions from this file, or you compile this file      
31
// and link it with other works to produce a work based on this file,       
32
// this file does not by itself cause the resulting work to be covered by   
33
// the GNU General Public License. However the source code for this file    
34
// must still be made available in accordance with section (3) of the GNU   
35
// General Public License v2.                                               
36
//
37
// This exception does not invalidate any other reasons why a work based    
38
// on this file might be covered by the GNU General Public License.         
39
// -------------------------------------------                              
40
// ####ECOSGPLCOPYRIGHTEND####                                              
41
//=============================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):     nickg,jlarmour
45
// Contributors:  
46
// Date:          2001-09-10
47
// Purpose:       POSIX mutex and condition variable function definitions
48
// Description:   This header contains POSIX API definitions for mutexes
49
//                and cond vars.
50
//              
51
// Usage:         #include <pthread.h>
52
//              
53
//
54
//####DESCRIPTIONEND####
55
//
56
//=============================================================================
57
 
58
#include <pkgconf/posix.h>
59
 
60
#include <sys/types.h>   // pthread_* types
61
#include <time.h>
62
//=============================================================================
63
// Mutexes
64
 
65
//-----------------------------------------------------------------------------
66
// Mutex attributes manipulation functions
67
 
68
// Initialize attribute object
69
externC int pthread_mutexattr_init ( pthread_mutexattr_t *attr);
70
 
71
// Destroy attribute object
72
externC int pthread_mutexattr_destroy ( pthread_mutexattr_t *attr);
73
 
74
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
75
 
76
// Set priority inversion protection protocol
77
externC int pthread_mutexattr_setprotocol ( pthread_mutexattr_t *attr,
78
                                            int protocol);
79
 
80
// Get priority inversion protection protocol
81
externC int pthread_mutexattr_getprotocol ( pthread_mutexattr_t *attr,
82
                                            int *protocol);
83
 
84
#if defined(_POSIX_THREAD_PRIO_PROTECT)
85
 
86
// Set priority for priority ceiling protocol
87
externC int pthread_mutexattr_setprioceiling ( pthread_mutexattr_t *attr,
88
                                               int prioceiling);
89
 
90
// Get priority for priority ceiling protocol
91
externC int pthread_mutexattr_getprioceiling ( pthread_mutexattr_t *attr,
92
                                               int *prioceiling);
93
 
94
// Set priority ceiling of given thread, returning old ceiling.
95
externC int pthread_mutex_setprioceiling( pthread_mutex_t *mutex,
96
                                          int prioceiling,
97
                                          int *old_ceiling);
98
 
99
// Get priority ceiling of given thread
100
externC int pthread_mutex_getprioceiling( pthread_mutex_t *mutex,
101
                                          int *prioceiling);
102
#endif
103
 
104
#endif
105
 
106
//-----------------------------------------------------------------------------
107
// Mutex functions
108
 
109
// Initialize mutex. If mutex_attr is NULL, use default attributes.
110
externC int pthread_mutex_init (pthread_mutex_t *mutex,
111
                                const pthread_mutexattr_t *mutex_attr);
112
 
113
// Destroy mutex.
114
externC int pthread_mutex_destroy (pthread_mutex_t *mutex);
115
 
116
// Lock mutex, waiting for it if necessary.
117
externC int pthread_mutex_lock (pthread_mutex_t *mutex);
118
 
119
// Try to lock mutex.
120
externC int pthread_mutex_trylock (pthread_mutex_t *mutex);
121
 
122
 
123
// Unlock mutex.
124
externC int pthread_mutex_unlock (pthread_mutex_t *mutex);
125
 
126
 
127
 
128
//=============================================================================
129
// Condition Variables
130
 
131
//-----------------------------------------------------------------------------
132
// Attribute manipulation functions
133
// We do not actually support any attributes at present, so these do nothing.
134
 
135
// Initialize condition variable attributes
136
externC int pthread_condattr_init (pthread_condattr_t *attr);
137
 
138
// Destroy condition variable attributes
139
externC int pthread_condattr_destroy (pthread_condattr_t *attr);
140
 
141
//-----------------------------------------------------------------------------
142
// Condition variable functions
143
 
144
// Initialize condition variable.
145
externC int pthread_cond_init (pthread_cond_t *cond,
146
                               const pthread_condattr_t *attr);
147
 
148
// Destroy condition variable.
149
externC int pthread_cond_destroy (pthread_cond_t *cond);
150
 
151
// Wake up one thread waiting for condition variable
152
externC int pthread_cond_signal (pthread_cond_t *cond);
153
 
154
// Wake up all threads waiting for condition variable
155
externC int pthread_cond_broadcast (pthread_cond_t *cond);
156
 
157
// Block on condition variable until signalled. The mutex is
158
// assumed to be locked before this call, will be unlocked
159
// during the wait, and will be re-locked on wakeup.
160
externC int pthread_cond_wait (pthread_cond_t *cond,
161
                               pthread_mutex_t *mutex);
162
 
163
// Block on condition variable until signalled, or the timeout expires.
164
externC int pthread_cond_timedwait (pthread_cond_t *cond,
165
                                    pthread_mutex_t *mutex,
166
                                    const struct timespec *abstime);
167
 
168
 
169
//-----------------------------------------------------------------------------
170
#endif // ifndef CYGONCE_POSIX_MUTEX_H
171
// End of mutex.h

powered by: WebSVN 2.1.0

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