Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
common.h
Go to the documentation of this file.
1 #ifndef CC_THREADCOMMON_H
2 #define CC_THREADCOMMON_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/C/basic.h> /* COIN_DLL_API */
37 
38 /* ********************************************************************** */
39 
40 /* Implementation note: it is important that this header file can be
41  included even when Coin was built with no threads support.
42 
43  (This simplifies client code, as we get away with far less #ifdef
44  HAVE_THREADS wrapping.) */
45 
46 /* ********************************************************************** */
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif /* __cplusplus */
51 
52 /* ********************************************************************** */
53 
54  typedef struct cc_sched cc_sched;
55  typedef struct cc_wpool cc_wpool;
56  typedef struct cc_worker cc_worker;
57  typedef struct cc_thread cc_thread;
58  typedef struct cc_mutex cc_mutex;
59  typedef struct cc_rwmutex cc_rwmutex;
60  typedef struct cc_condvar cc_condvar;
61  typedef struct cc_storage cc_storage;
62  typedef struct cc_fifo cc_fifo;
63  typedef struct cc_barrier cc_barrier;
64  typedef struct cc_recmutex cc_recmutex;
65 
66  /* used by rwmutex - read_precedence is default */
68  CC_READ_PRECEDENCE,
69  CC_WRITE_PRECEDENCE
70  };
71 
73  CC_NO_THREADS = -1,
74  CC_PTHREAD = 0,
75  CC_W32THREAD
76  };
77 
78  enum cc_retval {
79  CC_ERROR = 0,
80  CC_OK = 1,
81  CC_TIMEOUT,
82  CC_BUSY
83  };
84 
85  typedef enum cc_precedence cc_precedence;
87  typedef enum cc_retval cc_retval;
88 
89  /* ********************************************************************** */
90 
91  COIN_DLL_API int cc_thread_implementation(void);
92 
93  /* ********************************************************************** */
94 
95 #ifdef __cplusplus
96 } /* extern "C" */
97 #endif /* __cplusplus */
98 
99 #endif /* ! CC_THREADCOMMON_H */
struct cc_fifo cc_fifo
The type definition for the first-in, first-out queue structure.
Definition: common.h:62
cc_precedence
The precedence values for the read-write mutex.
Definition: common.h:67
cc_retval
The enumerator for return values of thread related functions.
Definition: common.h:78
struct cc_thread cc_thread
The type definition for the thread structure.
Definition: common.h:57
struct cc_sched cc_sched
The type definition for the thread schduler structure.
Definition: common.h:54
struct cc_mutex cc_mutex
The type definition for the mutex structure.
Definition: common.h:58
struct cc_wpool cc_wpool
The type definition for a worker pool structure.
Definition: common.h:55
struct cc_barrier cc_barrier
The type definition for the thread barrier structure.
Definition: common.h:63
cc_threads_implementation
The definition of the enumerator for identification of the thread type implemented.
Definition: common.h:72
int cc_thread_implementation(void)
Definition: common.cpp:62
struct cc_rwmutex cc_rwmutex
The type definition for the read-write mutex structure.
Definition: common.h:59
struct cc_storage cc_storage
The type definition for the thread local memory storage structure.
Definition: common.h:61
struct cc_condvar cc_condvar
The type definition for the conditional variable structure.
Definition: common.h:60
struct cc_worker cc_worker
The type definition for the worker thread structure.
Definition: common.h:56
struct cc_recmutex cc_recmutex
The type definition for the recursive mutex structure.
Definition: common.h:64