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 
32 #define P6MAXTHREADNAME 24
33 
39 #define P6MAXTHREADSTATENAME 24
40 
45 typedef enum {
46  P6TP_LOWEST,
47  P6TP_NORMAL,
48  P6TP_ELAVATED,
49  P6TP_HIGHEST,
50  P6TP_MAX
51 } P6THREADPRIORITY;
52 
59 typedef struct {
60  P6THREADID hThread;
61  P6TIME tStart;
62  P6WCHAR szwName[P6MAXTHREADNAME];
63  P6WCHAR szwState[P6MAXTHREADSTATENAME];
64  P6TIME tLastState;
65  P6THREADPRIORITY priority;
66 } P6THREADINFO;
67 
68 
83 interface p6ICreateErrorInfo : p6ICom
84 {
116  P6COMMETHOD initialize(P6R::P6ERR error,
117  const P6R::IID *piid,
118  const P6R::P6CHAR *pszFilename,
119  P6R::P6UINT32 cLine,
120  const P6R::P6WCHAR *pwszContext,
121  const P6R::P6WCHAR *pwszDescription) = 0;
122 };
123 // {D89A40FE-5144-4A4F-BFE6-93954BE2933B}
124 #define IF_p6ICreateErrorInfo {0xD89A40FE,0x5144,0x4A4F,{0xBF,0xE6,0x93,0x95,0x4B,0xE2,0x93,0x3B}}
125 
135 interface p6ICurThread : p6ICom
136 {
147  P6COMMETHOD setThreadState(const P6R::P6WCHAR *pcszwState) = 0;
148 
156  P6COMMETHOD setPriority(P6R::P6THREADPRIORITY nPriority) = 0;
157 
169  P6COMMETHOD getThreadInfo(P6R::P6THREADINFO *pInfoBuffer) = 0;
170 
178  P6COMMETHOD getThreadId(P6R::P6THREADID *pId) = 0;
179 
191  P6COMMETHOD getLogger(P6R::p6ILogProducer **ppThreadLogger) = 0;
192 
193 
202  P6COMMETHOD sleep(P6R::P6INTERVAL tTimeout) = 0;
203 
219  P6COMMETHOD createErrorInfo(P6R::p6ICreateErrorInfo **ppCreateInfo) = 0;
220 
237  P6COMMETHOD setErrorInfo(P6R::p6ICreateErrorInfo *pInfo) = 0;
238 
248  P6COMMETHOD getErrorInfo(P6R::p6IErrorInfo **ppInfo) = 0;
249 
261  P6COMMETHOD flushErrorInfo(P6R::p6ILogProducer *pLog) = 0;
262 };
263 // {54F02315-49CB-4053-A3EF-2AD07DFCA448}
264 #define IF_p6ICurThread {0x54F02315,0x49CB,0x4053,{0xA3,0xEF,0x2A,0xD0,0x7D,0xFC,0xA4,0x48}}
265 
276 typedef P6R::P6VOID (*P6THREADMAIN)(P6R::p6ICurThread *pCurThread,P6R::p6ILogProducer *pThreadLogger,P6R::P6VOID *pArg);
277 
278 
284 typedef P6UINT32 P6THREADFLAGS;
285 const P6THREADFLAGS P6TF_NONE = 0x00000000;
286 const P6THREADFLAGS P6TF_RESERVED1 = 0x80000000;
296 interface p6IThread : p6ICom
297 {
322  P6COMMETHOD initialize(P6R::P6THREADFLAGS fFlags,const P6R::P6WCHAR *pcszwThreadName,P6R::P6UINT32 cStack,P6R::P6THREADPRIORITY nPriority,P6R::P6THREADMAIN pfnThread,P6R::P6VOID *pArg) = 0;
323 
330  P6COMMETHOD start() = 0;
331 
337  P6COMMETHOD wait() = 0;
338 
350  P6COMMETHOD getThreadInfo(P6R::P6THREADINFO *pInfoBuffer) = 0;
351 
359  P6COMMETHOD setPriority(P6R::P6THREADPRIORITY nPriority) = 0;
360 };
361 
362 // {A6AF4610-CA9F-4B98-A98C-A7719AF6C69A}
363 #define IF_p6IThread {0xA6AF4610,0xCA9F,0x4B98,{0xA9,0x8C,0xA7,0x71,0x9A,0xF6,0xC6,0x9A}}
364 
365 // {CC7A814C-36B5-4729-8D9D-F270876A90EB}
366 #define COMP_p6Thread {0xCC7A814C,0x36B5,0x4729,{0x8D,0x9D,0xF2,0x70,0x87,0x6A,0x90,0xEB}}
367 
368 
374 interface p6IEnumThreadInfo : p6ICom
375 {
394  P6COMMETHOD next(P6R::P6UINT32 cElements,P6R::P6THREADINFO *parElements,P6R::P6UINT32 *pcReturned) = 0;
395 
404  P6COMMETHOD reset() = 0;
405 };
406 #define IF_p6IEnumThreadInfo {0x1E89BCB5,0xB0D7,0x4d56,{0xBE,0xAA,0x5C,0x6D,0xF3,0x40,0xAD,0x6D}}
407 
415 interface p6IThreadManager : p6ICom
416 {
428  P6COMMETHOD enumThreads(P6R::p6IEnumThreadInfo **ppEnum) = 0;
429 
430  P6COMMETHOD getCurrentThread(P6R::p6ICurThread **ppCurThread) = 0;
431 
432  P6COMMETHOD getCurrentThreadLogger(P6R::p6ILogProducer **ppLogger) = 0;
433 };
434 // {2F097B8D-3E90-4579-AB44-9A4550595FFD}
435 #define IF_p6IThreadManager {0x2F097B8D,0x3E90,0x4579,{0xAB,0x44,0x9A,0x45,0x50,0x59,0x5F,0xFD}}
436 
438 #ifdef __cplusplus
439 }
440 #endif
441 
442 } // namespace
443 
444 #endif
445 
unsigned int P6UINT32
Definition: p6types.h:40
wchar_t P6WCHAR
Wide character type see p6i18n.h.
Definition: p6types.h:76
Log producer component interfaces.
p6IErrorInfo interface definition
A universally unique indentifier (UUID).
Definition: p6types.h:131
P6UINT32 P6ERR
COM err return type see P6ERR.h.
Definition: p6types.h:109
#define P6COMMETHOD
Definition: p6types.h:872
P6INT64 P6TIME
The wallclock time represented as the number of microseconds since midnight January 1 1970 UTC...
Definition: p6types.h:228
P6SIZE P6THREADID
Defines a thread identifier.
Definition: p6types.h:111
P6COM definitions and interfaces.
void P6VOID
Definition: p6types.h:75
char P6CHAR
Narrow character type.
Definition: p6types.h:71