1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*
Copyright (C) 2001-2002 Stefan Westerfeld
stefan@space.twc.de
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef GSLARTSTHREADS_H
#define GSLARTSTHREADS_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* --- typedefs & structures --- */
typedef struct _GError {
const char *message;
} GError;
typedef struct _GThread {
void *data;
} GThread;
typedef enum
{
G_THREAD_PRIORITY_LOW,
G_THREAD_PRIORITY_NORMAL,
G_THREAD_PRIORITY_HIGH,
G_THREAD_PRIORITY_URGENT
} GThreadPriority;
#define g_mutex_lock gsl_arts_mutex_lock
#define g_mutex_trylock gsl_arts_mutex_trylock
#define g_mutex_unlock gsl_arts_mutex_unlock
#define g_mutex_new gsl_arts_mutex_new
#define g_mutex_free gsl_arts_mutex_free
#define g_cond_new gsl_arts_cond_new
#define g_cond_free gsl_arts_cond_free
#define g_cond_signal gsl_arts_cond_signal
#define g_cond_broadcast gsl_arts_cond_broadcast
#define g_cond_wait gsl_arts_cond_wait
#define g_cond_timed_wait gsl_arts_cond_timed_wait
#define g_thread_create_full gsl_arts_thread_create_full
#define g_thread_self gsl_arts_thread_self
#define g_thread_init gsl_arts_thread_init
#define g_error_free(x) g_assert_not_reached()
/* --- prototypes --- */
gpointer gsl_arts_mutex_new ();
void gsl_arts_mutex_free (gpointer mutex);
void gsl_arts_mutex_lock (gpointer mutex);
gboolean gsl_arts_mutex_trylock (gpointer mutex);
void gsl_arts_mutex_unlock (gpointer mutex);
gpointer gsl_arts_cond_new ();
void gsl_arts_cond_free (gpointer cond);
void gsl_arts_cond_signal (gpointer cond);
void gsl_arts_cond_broadcast (gpointer cond);
void gsl_arts_cond_wait (gpointer cond, gpointer mutex);
void gsl_arts_cond_timed_wait (gpointer cond, gpointer mutex, GTimeVal *abstime);
GThread* gsl_arts_thread_create_full(gpointer (*func)(gpointer data),
gpointer data,
gulong stack_size,
gboolean joinable,
gboolean bound,
GThreadPriority priority,
GError **error);
gpointer gsl_arts_thread_self ();
void gsl_arts_thread_init (gpointer arg);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* vim:set ts=8 sts=2 sw=2: */
#endif // GSLARTSTHREADS_H
|