Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6thread.h
Go to the documentation of this file.
1 
11 #ifndef P6THREAD_H__
12 #define P6THREAD_H__ 1
13 
14 #ifdef DOX_IGNORE
15 #include "p6com.h"
16 #endif
17 
18 #include "p6log.h"
19 #include "p6errorinfo.h"
20 
21 namespace P6R {
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
42 {
75  const P6R::IID *piid,
76  const P6R::P6CHAR *pszFilename,
77  P6R::P6UINT32 cLine,
78  const P6R::P6WCHAR *pwszContext,
79  const P6R::P6WCHAR *pwszDescription) = 0;
80 };
81 // {D89A40FE-5144-4A4F-BFE6-93954BE2933B}
82 #define IF_p6ICreateErrorInfo {0xD89A40FE,0x5144,0x4A4F,{0xBF,0xE6,0x93,0x95,0x4B,0xE2,0x93,0x3B}}
83 
93 interface p6ICurThread : p6ICom
94 {
105  P6COMMETHOD setThreadState(const P6R::P6WCHAR *pcszwState) = 0;
106 
114  P6COMMETHOD setPriority(P6R::P6THREADPRIORITY nPriority) = 0;
115 
127  P6COMMETHOD getThreadInfo(P6R::P6THREADINFO *pInfoBuffer) = 0;
128 
136  P6COMMETHOD getThreadId(P6R::P6THREADID *pId) = 0;
137 
149  P6COMMETHOD getLogger(P6R::p6ILogProducer **ppThreadLogger) = 0;
150 
151 
160  P6COMMETHOD sleep(P6R::P6INTERVAL tTimeout) = 0;
161 
178 
196 
206  P6COMMETHOD getErrorInfo(P6R::p6IErrorInfo **ppInfo) = 0;
207 
219  P6COMMETHOD flushErrorInfo(P6R::p6ILogProducer *pLog) = 0;
220 };
221 // {54F02315-49CB-4053-A3EF-2AD07DFCA448}
222 #define IF_p6ICurThread {0x54F02315,0x49CB,0x4053,{0xA3,0xEF,0x2A,0xD0,0x7D,0xFC,0xA4,0x48}}
223 
234 typedef P6R::P6VOID (*P6THREADMAIN)(P6R::p6ICurThread *pCurThread,P6R::p6ILogProducer *pThreadLogger,P6R::P6VOID *pArg);
235 
242 const P6THREADFLAGS P6TF_NONE = 0x00000000;
243 const P6THREADFLAGS P6TF_RESERVED1 = 0x80000000;
253 interface p6IThread : p6ICom
254 {
279  P6COMMETHOD initialize(P6R::P6THREADFLAGS fFlags,const P6R::P6WCHAR *pcszwThreadName,P6R::P6UINT32 cStack,P6R::P6THREADPRIORITY nPriority,P6R::P6THREADMAIN pfnThread,P6R::P6VOID *pArg) = 0;
280 
287  P6COMMETHOD start() = 0;
288 
294  P6COMMETHOD wait() = 0;
295 
307  P6COMMETHOD getThreadInfo(P6R::P6THREADINFO *pInfoBuffer) = 0;
308 
316  P6COMMETHOD setPriority(P6R::P6THREADPRIORITY nPriority) = 0;
317 };
318 
319 // {A6AF4610-CA9F-4B98-A98C-A7719AF6C69A}
320 #define IF_p6IThread {0xA6AF4610,0xCA9F,0x4B98,{0xA9,0x8C,0xA7,0x71,0x9A,0xF6,0xC6,0x9A}}
321 
322 // {CC7A814C-36B5-4729-8D9D-F270876A90EB}
323 #define COMP_p6Thread {0xCC7A814C,0x36B5,0x4729,{0x8D,0x9D,0xF2,0x70,0x87,0x6A,0x90,0xEB}}
324 
325 
332 {
351  P6COMMETHOD next(P6R::P6UINT32 cElements,P6R::P6THREADINFO *parElements,P6R::P6UINT32 *pcReturned) = 0;
352 
361  P6COMMETHOD reset() = 0;
362 };
363 #define IF_p6IEnumThreadInfo {0x1E89BCB5,0xB0D7,0x4d56,{0xBE,0xAA,0x5C,0x6D,0xF3,0x40,0xAD,0x6D}}
364 
373 {
386 
388 
389  P6COMMETHOD getCurrentThreadLogger(P6R::p6ILogProducer **ppLogger) = 0;
390 };
391 // {2F097B8D-3E90-4579-AB44-9A4550595FFD}
392 #define IF_p6IThreadManager {0x2F097B8D,0x3E90,0x4579,{0xAB,0x44,0x9A,0x45,0x50,0x59,0x5F,0xFD}}
393 
395 #ifdef __cplusplus
396 }
397 #endif
398 
399 } // namespace
400 
401 #endif
402 
P6UINT32 P6THREADFLAGS
Defines thread startup flags.
Definition: p6thread.h:241
unsigned int P6UINT32
Definition: p6types.h:40
virtual P6R::P6ERR initialize(P6R::P6THREADFLAGS fFlags, const P6R::P6WCHAR *pcszwThreadName, P6R::P6UINT32 cStack, P6R::P6THREADPRIORITY nPriority, P6R::P6THREADMAIN pfnThread, P6R::P6VOID *pArg)=0
This method initializes the component for use and must be called before calling any other method...
virtual P6R::P6ERR setPriority(P6R::P6THREADPRIORITY nPriority)=0
Sets the threads priority to the priority specified in nPriority.
Enumerator for the running thread table.
Definition: p6thread.h:331
P6R::P6VOID(* P6THREADMAIN)(P6R::p6ICurThread *pCurThread, P6R::p6ILogProducer *pThreadLogger, P6R::P6VOID *pArg)
Defines the signature of a thread main entry point.
Definition: p6thread.h:234
This interface is used by a thread to manage information about itself.
Definition: p6thread.h:93
virtual P6R::P6ERR setPriority(P6R::P6THREADPRIORITY nPriority)=0
Set the curent threads priority to the priority specified in nPriority.
virtual P6R::P6ERR setErrorInfo(P6R::p6ICreateErrorInfo *pInfo)=0
COM Exceptions - Sets the provided p6IErrorInfo interface into the threads error list.
virtual P6R::P6ERR next(P6R::P6UINT32 cElements, P6R::P6THREADINFO *parElements, P6R::P6UINT32 *pcReturned)=0
This method is used to iterate the running thread table and returns information about each running th...
const P6THREADFLAGS P6TF_NONE
No flags specified.
Definition: p6thread.h:242
This interface is used to externally manage a thread.
Definition: p6thread.h:253
virtual P6R::P6ERR getLogger(P6R::p6ILogProducer **ppThreadLogger)=0
Retrieves an addref'd interface pointer for the current threads default logger.
virtual P6R::P6ERR initialize(P6R::P6ERR error, const P6R::IID *piid, const P6R::P6CHAR *pszFilename, P6R::P6UINT32 cLine, const P6R::P6WCHAR *pwszContext, const P6R::P6WCHAR *pwszDescription)=0
Initializes the exception record with information about the error condition.
wchar_t P6WCHAR
Wide character type see p6i18n.h.
Definition: p6types.h:76
virtual P6R::P6ERR reset()=0
Resets the enumeration to the begining.
virtual P6R::P6ERR getCurrentThreadLogger(P6R::p6ILogProducer **ppLogger)=0
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:96
This interface is used to create new threads as well as get an enumerator to get information about ea...
Definition: p6thread.h:372
Log producer component interfaces.
virtual P6R::P6ERR getThreadInfo(P6R::P6THREADINFO *pInfoBuffer)=0
Retrieves information about the thread, such as thread ID, start time, name, current state and priori...
virtual P6R::P6ERR setThreadState(const P6R::P6WCHAR *pcszwState)=0
This method sets the current threads state.
p6IErrorInfo interface definition
virtual P6R::P6ERR createErrorInfo(P6R::p6ICreateErrorInfo **ppCreateInfo)=0
COM Exceptions - Creates and returns an uninitialized p6ICreateErrorInfo interface.
virtual P6R::P6ERR enumThreads(P6R::p6IEnumThreadInfo **ppEnum)=0
This method retrieves an enumerator which is used to iterate through all the threads in the RTT...
A universally unique indentifier (UUID).
Definition: p6types.h:130
virtual P6R::P6ERR sleep(P6R::P6INTERVAL tTimeout)=0
Put the current thread to sleep for the specified timeout period.
virtual P6R::P6ERR getCurrentThread(P6R::p6ICurThread **ppCurThread)=0
virtual P6R::P6ERR getThreadInfo(P6R::P6THREADINFO *pInfoBuffer)=0
Retrieves information about the current threads such as thread ID, start time, name, current state and priority.
P6UINT32 P6ERR
COM err return type see P6ERR.h.
Definition: p6types.h:109
#define P6COMMETHOD
Definition: p6types.h:917
virtual P6R::P6ERR flushErrorInfo(P6R::p6ILogProducer *pLog)=0
COM Exceptions - This method causes all outstanding exception records to be logged and then flushed f...
const P6THREADFLAGS P6TF_RESERVED1
Reserved for runtime use only.
Definition: p6thread.h:243
P6COM definitions and interfaces.
virtual P6R::P6ERR getErrorInfo(P6R::p6IErrorInfo **ppInfo)=0
COM Exceptions - Retrieves the next exception record (p6IErrorInfo interface) for the current thread...
void P6VOID
Definition: p6types.h:75
virtual P6R::P6ERR getThreadId(P6R::P6THREADID *pId)=0
Retrieves the current threads thread ID.
virtual P6R::P6ERR start()=0
Starts the thread.
virtual P6R::P6ERR wait()=0
Wait (block) until the thread terminates.
This interface is used to initialize a COM exception record with information about an error condition...
Definition: p6thread.h:41
char P6CHAR
Narrow character type.
Definition: p6types.h:71