Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

ot_VxThread.h

Go to the documentation of this file.
00001 #ifndef __VXTHREAD_H__
00002 #define __VXTHREAD_H__
00003 /*
00004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00005 %% Project:     omniORB
00006 %% Filename:    $Filename$
00007 %% Author:      Guillaume/Bill ARRECKX
00008 %%              Copyright Wavetek Wandel & Goltermann, Plymouth.
00009 %% Description: OMNI thread implementation classes for VxWorks threads
00010 %% Notes:
00011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00012 %% $Log: ot_VxThread.h,v $
00013 %% Revision 1.1  2003/05/25 05:29:04  eb
00014 %% see ChangeLog
00015 %%
00016 %% Revision 1.1.2.1  2003/02/17 02:03:07  dgrisby
00017 %% vxWorks port. (Thanks Michael Sturm / Acterna Eningen GmbH).
00018 %%
00019 %% Revision 1.1.1.1  2002/11/19 14:55:21  sokcevti
00020 %% OmniOrb4.0.0 VxWorks port
00021 %%
00022 %% Revision 1.2  2002/06/14 12:45:50  engeln
00023 %% unnecessary members in condition removed.
00024 %% ---
00025 %%
00026 %% Revision 1.1.1.1  2002/04/02 10:08:49  sokcevti
00027 %% omniORB4 initial realease
00028 %%
00029 %% Revision 1.1  2001/03/23 16:50:23  hartmut
00030 %% Initial Version 2.8
00031 %%
00032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00033 */
00034 
00035 
00037 // Includes
00039 #include <vxWorks.h>
00040 #include <semLib.h>
00041 #include <taskLib.h>
00042 
00043 
00045 // Externs prototypes
00047 extern "C" void omni_thread_wrapper(void* ptr);
00048 
00049 
00051 // Exported macros
00052 // Note: These are added as private members in each class implementation.
00054 #define OMNI_MUTEX_IMPLEMENTATION \
00055    SEM_ID mutexID;      \
00056    bool m_bConstructed;
00057 
00058 #define OMNI_CONDITION_IMPLEMENTATION \
00059    long waiters_; \
00060    SEM_ID waiters_lock_; \
00061    SEM_ID sema_;
00062 
00063 #define OMNI_SEMAPHORE_IMPLEMENTATION \
00064    SEM_ID semID;
00065 
00066 #define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
00067         if(semTake(mutexID, WAIT_FOREVER) != OK)        \
00068         {       \
00069                 throw omni_thread_fatal(errno); \
00070         }
00071 
00072 #define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
00073         if(semGive(mutexID) != OK)      \
00074         {       \
00075                 throw omni_thread_fatal(errno); \
00076         }
00077 
00078 #define OMNI_THREAD_IMPLEMENTATION \
00079    friend void omni_thread_wrapper(void* ptr); \
00080    static int vxworks_priority(priority_t); \
00081    omni_condition *running_cond; \
00082    void* return_val; \
00083    int tid; \
00084    public: \
00085    static void attach(void); \
00086    static void detach(void); \
00087    static void show(void);
00088 
00089 
00091 // Porting macros
00093 // This is a wrapper function for the 'main' function which does not exists
00094 //  as such in VxWorks. The wrapper creates a launch function instead,
00095 //  which spawns the application wrapped in a omni_thread.
00096 // Argc will always be null.
00098 #define main( discarded_argc, discarded_argv ) \
00099         omni_discard_retval() \
00100           { \
00101           throw; \
00102           } \
00103         int omni_main( int argc, char **argv ); \
00104         void launch( ) \
00105           { \
00106           omni_thread* th = new omni_thread( (void(*)(void*))omni_main );\
00107           th->start();\
00108           }\
00109         int omni_main( int argc, char **argv )
00110 
00111 
00112 #endif // ndef __VXTHREAD_H__

Generated on Tue Mar 30 21:31:49 2004 for GNU Radio by doxygen 1.3.2