Back to index

lightning-sunbird  0.9+nobinonly
GUSIForeignThreads.h
Go to the documentation of this file.
00001 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
00002 // % Project  :      GUSI                               -      Grand Unified Socket Interface                   
00003 // % File            :      GUSIForeignThreads.nw       -      Foreign thread support                
00004 // % Author   :      Matthias Neeracher                                           
00005 // % Language :      C++                                                        
00006 // %                                                                       
00007 // % $Log: GUSIForeignThreads.h,v $
00008 // % Revision 1.1  2001/03/11 22:35:11  sgehani%netscape.com
00009 // % First Checked In.
00010 // %                                       
00011 // % Revision 1.4  2000/12/23 06:10:48  neeri                              
00012 // % Use kPowerPCCFragArch, NOT GetCurrentArchitecture()                   
00013 // %                                                                       
00014 // % Revision 1.3  2000/05/23 07:00:00  neeri                              
00015 // % Improve formatting                                                    
00016 // %                                                                       
00017 // % Revision 1.2  2000/03/06 08:28:32  neeri                              
00018 // % Releasing 2.0.5                                                       
00019 // %                                                                       
00020 // % Revision 1.1  1999/09/09 07:18:06  neeri                              
00021 // % Added support for foreign threads                                     
00022 // %                                                                       
00023 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
00024 //                                                                         
00025 // \chapter{Supporting threads made outside of GUSI}                       
00026 //                                                                         
00027 // As convenient as the pthreads interface is, some applications may link to other 
00028 // libraries which create thread manager threads directly, such as the PowerPlant
00029 // thread classes.                                                         
00030 //                                                                         
00031 // Unfortunately, there is no really elegant way to welcome these lost sheep into the
00032 // pthread flock, since the thread manager offers no way to retrieve thread switching
00033 // and termination procedures. We therefore have to resort to a violent technique used
00034 // already successfully for MPW support: On CFM, we override the default entry point and
00035 // use the CFM manager to find the real implementation.                    
00036 //                                                                         
00037 // For non-CFM, we unfortunately don't have such an effective technique, since the 
00038 // thread manager is called through traps (and no, I'm not going to patch any traps
00039 // for this). You will therefore have to recompile your foreign libraries with
00040 // a precompiled header that includes \texttt{GUSIForeignThreads.h}.       
00041 //                                                                         
00042 // <GUSIForeignThreads.h>=                                                 
00043 #ifndef _GUSIForeignThreads_
00044 #define _GUSIForeignThreads_
00045 
00046 #define NewThread(style, entry, param, stack, options, result, made)  \
00047        GUSINewThread((style), (entry), (param), (stack), (options), (result), (made))
00048 #define SetThreadSwitcher(thread, switcher, param, inOrOut) \
00049        GUSISetThreadSwitcher((thread), (switcher), (param), (inOrOut))
00050 #define SetThreadTerminator(thread, threadTerminator, terminationProcParam) \
00051        GUSISetThreadTerminator((thread), (threadTerminator), (terminationProcParam))
00052 #endif /* _GUSIForeignThreads_ */