Coin: common.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

common.h
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
49extern "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 */
67 enum cc_precedence {
68 CC_READ_PRECEDENCE,
69 CC_WRITE_PRECEDENCE
70 };
71
72 enum cc_threads_implementation {
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;
86 typedef enum cc_threads_implementation cc_threads_implementation;
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 */
cc_threads_implementation
cc_threads_implementation
The type definition for the implemented thread enumerator.
Definition common.h:72
cc_precedence
cc_precedence
The type definition of the cc_precedence enumerator.
Definition common.h:67
cc_retval
cc_retval
The type definition for the return value enumerator.
Definition common.h:78