4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 %% Filename: $Filename$
7 %% Author: Guillaume/Bill ARRECKX
8 %% Copyright Wavetek Wandel & Goltermann, Plymouth.
9 %% Description: OMNI thread implementation classes for VxWorks threads
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 %% Revision 1.1 2004/04/10 18:00:52 eb
16 %% Revision 1.1.1.1 2004/03/01 00:20:27 eb
19 %% Revision 1.1 2003/05/25 05:29:04 eb
22 %% Revision 1.1.2.1 2003/02/17 02:03:07 dgrisby
23 %% vxWorks port. (Thanks Michael Sturm / Acterna Eningen GmbH).
25 %% Revision 1.1.1.1 2002/11/19 14:55:21 sokcevti
26 %% OmniOrb4.0.0 VxWorks port
28 %% Revision 1.2 2002/06/14 12:45:50 engeln
29 %% unnecessary members in condition removed.
32 %% Revision 1.1.1.1 2002/04/02 10:08:49 sokcevti
33 %% omniORB4 initial realease
35 %% Revision 1.1 2001/03/23 16:50:23 hartmut
36 %% Initial Version 2.8
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 ///////////////////////////////////////////////////////////////////////////
44 ///////////////////////////////////////////////////////////////////////////
50 ///////////////////////////////////////////////////////////////////////////
52 ///////////////////////////////////////////////////////////////////////////
53 extern "C" void omni_thread_wrapper(void* ptr);
56 ///////////////////////////////////////////////////////////////////////////
58 // Note: These are added as private members in each class implementation.
59 ///////////////////////////////////////////////////////////////////////////
60 #define OMNI_MUTEX_IMPLEMENTATION \
64 #define OMNI_CONDITION_IMPLEMENTATION \
66 SEM_ID waiters_lock_; \
69 #define OMNI_SEMAPHORE_IMPLEMENTATION \
72 #define OMNI_MUTEX_LOCK_IMPLEMENTATION \
73 if(semTake(mutexID, WAIT_FOREVER) != OK) \
75 throw omni_thread_fatal(errno); \
78 #define OMNI_MUTEX_UNLOCK_IMPLEMENTATION \
79 if(semGive(mutexID) != OK) \
81 throw omni_thread_fatal(errno); \
84 #define OMNI_THREAD_IMPLEMENTATION \
85 friend void omni_thread_wrapper(void* ptr); \
86 static int vxworks_priority(priority_t); \
87 omni_condition *running_cond; \
91 static void attach(void); \
92 static void detach(void); \
93 static void show(void);
96 ///////////////////////////////////////////////////////////////////////////
98 ///////////////////////////////////////////////////////////////////////////
99 // This is a wrapper function for the 'main' function which does not exists
100 // as such in VxWorks. The wrapper creates a launch function instead,
101 // which spawns the application wrapped in a omni_thread.
102 // Argc will always be null.
103 ///////////////////////////////////////////////////////////////////////////
104 #define main( discarded_argc, discarded_argv ) \
105 omni_discard_retval() \
109 int omni_main( int argc, char **argv ); \
112 omni_thread* th = new omni_thread( (void(*)(void*))omni_main );\
115 int omni_main( int argc, char **argv )
118 #endif // ndef __VXTHREAD_H__