p6thread.h

Go to the documentation of this file.
00001 
00011 #ifndef P6THREAD_H__
00012 #define P6THREAD_H__ 1
00013 
00014 #ifdef DOX_IGNORE
00015 #include "p6com.h" 
00016 #endif
00017 
00018 #include "p6log.h"
00019 #include "p6errorinfo.h"
00020 
00021 namespace P6R {
00022 
00023 #ifdef  __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 
00032 #define P6MAXTHREADNAME 24
00033 
00039 #define P6MAXTHREADSTATENAME  24
00040 
00045 typedef enum {
00046    P6TP_LOWEST,      
00047    P6TP_NORMAL,      
00048    P6TP_ELAVATED,    
00049    P6TP_HIGHEST,     
00050    P6TP_MAX
00051 } P6THREADPRIORITY;
00052 
00059 typedef struct {
00060    P6THREADID        hThread;                         
00061    P6TIME            tStart;                          
00062    P6WCHAR           szwName[P6MAXTHREADNAME];        
00063    P6WCHAR           szwState[P6MAXTHREADSTATENAME];  
00064    P6TIME            tLastState;                      
00065    P6THREADPRIORITY  priority;                        
00066 } P6THREADINFO;
00067 
00068 
00083 interface p6ICreateErrorInfo : p6ICom
00084 {
00116    P6COMMETHOD                initialize(P6R::P6ERR error,
00117                                          const P6R::IID *piid,
00118                                          const P6R::P6CHAR *pszFilename,
00119                                          P6R::P6UINT32 cLine,
00120                                          const P6R::P6WCHAR *pwszContext,
00121                                          const P6R::P6WCHAR *pwszDescription) = 0;
00122 };
00123 // {D89A40FE-5144-4A4F-BFE6-93954BE2933B}
00124 #define IF_p6ICreateErrorInfo {0xD89A40FE,0x5144,0x4A4F,{0xBF,0xE6,0x93,0x95,0x4B,0xE2,0x93,0x3B}}
00125 
00135 interface p6ICurThread : p6ICom
00136 {
00147    P6COMMETHOD                   setThreadState(const P6R::P6WCHAR *pcszwState) = 0;
00148 
00156    P6COMMETHOD                   setPriority(P6R::P6THREADPRIORITY nPriority) = 0;
00157    
00169    P6COMMETHOD                   getThreadInfo(P6R::P6THREADINFO *pInfoBuffer) = 0;
00170 
00178    P6COMMETHOD                   getThreadId(P6R::P6THREADID *pId) = 0;
00179 
00191    P6COMMETHOD                   getLogger(P6R::p6ILogProducer **ppThreadLogger) = 0;
00192 
00193 
00202    P6COMMETHOD                   sleep(P6R::P6INTERVAL tTimeout) = 0;
00203 
00219    P6COMMETHOD                   createErrorInfo(P6R::p6ICreateErrorInfo **ppCreateInfo) = 0;
00220    
00237    P6COMMETHOD                   setErrorInfo(P6R::p6ICreateErrorInfo *pInfo) = 0;
00238 
00248    P6COMMETHOD                   getErrorInfo(P6R::p6IErrorInfo **ppInfo) = 0;
00249 
00261    P6COMMETHOD                   flushErrorInfo(P6R::p6ILogProducer *pLog) = 0;
00262 };
00263 // {54F02315-49CB-4053-A3EF-2AD07DFCA448}
00264 #define IF_p6ICurThread          {0x54F02315,0x49CB,0x4053,{0xA3,0xEF,0x2A,0xD0,0x7D,0xFC,0xA4,0x48}}
00265 
00276 typedef P6R::P6VOID (*P6THREADMAIN)(P6R::p6ICurThread *pCurThread,P6R::p6ILogProducer *pThreadLogger,P6R::P6VOID *pArg);
00277 
00278 
00284 typedef P6UINT32 P6THREADFLAGS;
00285 const P6THREADFLAGS  P6TF_NONE      = 0x00000000;  
00286 const P6THREADFLAGS  P6TF_RESERVED1 = 0x80000000;  
00296 interface p6IThread : p6ICom
00297 {
00322    P6COMMETHOD                   initialize(P6R::P6THREADFLAGS fFlags,const P6R::P6WCHAR *pcszwThreadName,P6R::P6UINT32 cStack,P6R::P6THREADPRIORITY nPriority,P6R::P6THREADMAIN pfnThread,P6R::P6VOID *pArg) = 0;
00323    
00330    P6COMMETHOD                   start() = 0; 
00331    
00337    P6COMMETHOD                   wait() = 0;
00338 
00350    P6COMMETHOD                   getThreadInfo(P6R::P6THREADINFO *pInfoBuffer) = 0;
00351 
00359    P6COMMETHOD                   setPriority(P6R::P6THREADPRIORITY nPriority) = 0;
00360 };
00361 
00362 // {A6AF4610-CA9F-4B98-A98C-A7719AF6C69A}
00363 #define IF_p6IThread          {0xA6AF4610,0xCA9F,0x4B98,{0xA9,0x8C,0xA7,0x71,0x9A,0xF6,0xC6,0x9A}}
00364 
00365 #define COMP_p6Thread         {0xCC7A814C,0x36B5,0x4729,{0x8D,0x9D,0xF2,0x70,0x87,0x6A,0x90,0xEB}}
00366 
00367 
00373 interface p6IEnumThreadInfo : p6ICom
00374 {
00393    P6COMMETHOD                   next(P6R::P6UINT32 cElements,P6R::P6THREADINFO *parElements,P6R::P6UINT32 *pcReturned) = 0;
00394 
00403    P6COMMETHOD                   reset() = 0;
00404 };
00405 #define IF_p6IEnumThreadInfo {0x1E89BCB5,0xB0D7,0x4d56,{0xBE,0xAA,0x5C,0x6D,0xF3,0x40,0xAD,0x6D}}
00406 
00414 interface p6IThreadManager : p6ICom
00415 {
00427    P6COMMETHOD                   enumThreads(P6R::p6IEnumThreadInfo **ppEnum) = 0;
00428 
00429    P6COMMETHOD                   getCurrentThread(P6R::p6ICurThread **ppCurThread) = 0;
00430 
00431    P6COMMETHOD                   getCurrentThreadLogger(P6R::p6ILogProducer **ppLogger) = 0;
00432 };
00433 // {2F097B8D-3E90-4579-AB44-9A4550595FFD}
00434 #define IF_p6IThreadManager   {0x2F097B8D,0x3E90,0x4579,{0xAB,0x44,0x9A,0x45,0x50,0x59,0x5F,0xFD}}
00435 
00437 #ifdef  __cplusplus
00438 }
00439 #endif
00440 
00441 } // namespace
00442 
00443 #endif
00444 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Copyright © 2004 - 2010 P6R Inc. - All Rights Reserved.