Imported Upstream version 3.0.4
[debian/gnuradio] / gnuradio-core / src / lib / omnithread / ot_mach.h
1 //                              Package : omnithread
2 // omnithread/posix.h           Created : 7/97 lars immisch lars@ibp.de
3 //
4 //    Copyright (C) 1994,1995,1996, 1997 Immisch, becker & Partner
5 //
6 //    This file is part of the omnithread library
7 //
8 //    The omnithread library is free software; you can redistribute it and/or
9 //    modify it under the terms of the GNU Library General Public
10 //    License as published by the Free Software Foundation; either
11 //    version 2 of the License, or (at your option) any later version.
12 //
13 //    This library is distributed in the hope that it will be useful,
14 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //    Library General Public License for more details.
17 //
18 //    You should have received a copy of the GNU Library General Public
19 //    License along with this library; if not, write to the Free
20 //    Software Foundation, Inc., 51 Franklin Street, Boston, MA  
21 //    02110-1301, USA
22 //
23 //
24 // OMNI thread implementation classes for posix threads
25 //
26
27 #ifndef __omnithread_mach_h_
28 #define __omnithread_mach_h_
29
30 #include <mach/cthreads.h>
31
32 extern "C" void* omni_thread_wrapper(void* ptr);
33
34 #define OMNI_MUTEX_IMPLEMENTATION                       \
35     struct mutex mach_mutex;
36
37 #define OMNI_CONDITION_IMPLEMENTATION                   \
38     struct condition mach_cond;
39
40 #define OMNI_SEMAPHORE_IMPLEMENTATION                   \
41     omni_mutex m;                                       \
42     omni_condition c;                                   \
43     int value;
44
45
46 #define OMNI_THREAD_IMPLEMENTATION                      \
47     cthread_t mach_thread;                              \
48     static int mach_priority(priority_t);               \
49     friend void* omni_thread_wrapper(void* ptr);
50
51 #endif