Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

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_8h-source.html,v $
00012 %% Revision 1.7  2006/07/09 01:05:10  eb
00012 %% updated to CVS 2006-07-08
00012 %%
00013 %% Revision 1.1.1.1  2004/04/10 18:00:52  eb
00014 %% Initial subversions check in of GNU Radio 2.x work-in-progress
00015 %%
00016 %% Revision 1.1.1.1  2004/03/01 00:20:27  eb
00017 %% initial checkin
00018 %%
00019 %% Revision 1.1  2003/05/25 05:29:04  eb
00020 %% see ChangeLog
00021 %%
00022 %% Revision 1.1.2.1  2003/02/17 02:03:07  dgrisby
00023 %% vxWorks port. (Thanks Michael Sturm / Acterna Eningen GmbH).
00024 %%
00025 %% Revision 1.1.1.1  2002/11/19 14:55:21  sokcevti
00026 %% OmniOrb4.0.0 VxWorks port
00027 %%
00028 %% Revision 1.2  2002/06/14 12:45:50  engeln
00029 %% unnecessary members in condition removed.
00030 %% ---
00031 %%
00032 %% Revision 1.1.1.1  2002/04/02 10:08:49  sokcevti
00033 %% omniORB4 initial realease
00034 %%
00035 %% Revision 1.1  2001/03/23 16:50:23  hartmut
00036 %% Initial Version 2.8
00037 %%
00038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00039 */
00040 
00041 
00043 // Includes
00045 #include <vxWorks.h>
00046 #include <semLib.h>
00047 #include <taskLib.h>
00048 
00049 
00051 // Externs prototypes
00053 extern "C" void omni_thread_wrapper(void* ptr);
00054 
00055 
00057 // Exported macros
00058 // Note: These are added as private members in each class implementation.
00060 #define OMNI_MUTEX_IMPLEMENTATION \
00061    SEM_ID mutexID;      \
00062    bool m_bConstructed;
00063 
00064 #define OMNI_CONDITION_IMPLEMENTATION \
00065    long waiters_; \
00066    SEM_ID waiters_lock_; \
00067    SEM_ID sema_;
00068 
00069 #define OMNI_SEMAPHORE_IMPLEMENTATION \
00070    SEM_ID semID;
00071 
00072 #define OMNI_MUTEX_LOCK_IMPLEMENTATION                  \
00073         if(semTake(mutexID, WAIT_FOREVER) != OK)        \
00074         {       \
00075                 throw omni_thread_fatal(errno); \
00076         }
00077 
00078 #define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
00079         if(semGive(mutexID) != OK)      \
00080         {       \
00081                 throw omni_thread_fatal(errno); \
00082         }
00083 
00084 #define OMNI_THREAD_IMPLEMENTATION \
00085    friend void omni_thread_wrapper(void* ptr); \
00086    static int vxworks_priority(priority_t); \
00087    omni_condition *running_cond; \
00088    void* return_val; \
00089    int tid; \
00090    public: \
00091    static void attach(void); \
00092    static void detach(void); \
00093    static void show(void);
00094 
00095 
00097 // Porting macros
00099 // This is a wrapper function for the 'main' function which does not exists
00100 //  as such in VxWorks. The wrapper creates a launch function instead,
00101 //  which spawns the application wrapped in a omni_thread.
00102 // Argc will always be null.
00104 #define main( discarded_argc, discarded_argv ) \
00105         omni_discard_retval() \
00106           { \
00107           throw; \
00108           } \
00109         int omni_main( int argc, char **argv ); \
00110         void launch( ) \
00111           { \
00112           omni_thread* th = new omni_thread( (void(*)(void*))omni_main );\
00113           th->start();\
00114           }\
00115         int omni_main( int argc, char **argv )
00116 
00117 
00118 #endif // ndef __VXTHREAD_H__

Generated on Sat Jul 8 17:04:52 2006 for GNU Radio 2.x by  doxygen 1.4.1