-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThread.h
More file actions
93 lines (72 loc) · 2.3 KB
/
Thread.h
File metadata and controls
93 lines (72 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef _SIMPLE_THREAD_H
#define _SIMPLE_THREAD_H
////////////////////////////////////////////////////////////////////////////////
//
// External definitions.
//
// Including the definitions for general using.
//
// These definitions are generally used in different operation system.
//
////////////////////////////////////////////////////////////////////////////////
//Process
typedef _BOOL (* _PROCESS)(_OBJECT);
//Accerelated
#define THREAD_ACCELERATED 0x00000001
//Running
#define THREAD_RUNNING 0x00000002
//Decelerated
#define THREAD_DECELERATED 0x00000003
//Stopped
#define THREAD_STOPPED 0x00000000
//Max Sequence
#define MAX_SEQUENCE 0x7FFFFFFF
////////////////////////////////////////////////////////////////////////////////
//
// General definitions.
//
// Including the definitions for general using.
//
// These definitions are generally used in different operation system.
//
////////////////////////////////////////////////////////////////////////////////
typedef struct tagSimpleThread
{
//Name
_PASCALSTRING strName;
//Status
//Thread Life Cycle : accelerated, running, decelerated and stopped.
_UINT32 nStatus;
//Watch
SimpleWatch watch;
//Wait Time (Millisecond)
_UINT32 nWaitTime;
//Sequence
_INT32 nSequence;
//Switch
//Process ON or OFF.
_BOOL bSwitch;
//Process
_PROCESS lpProcess;
//Object
_OBJECT lpObject;
}
SimpleThread;
////////////////////////////////////////////////////////////////////////////////
//
// General functions.
//
////////////////////////////////////////////////////////////////////////////////
extern void InitializeThread(SimpleThread* pThread);
extern _BOOL IsThreadRunning(SimpleThread* pThread);
extern _BOOL IsThreadStopped(SimpleThread* pThread);
extern _INT32 GetThreadSequence(SimpleThread* pThead);
extern _BOOL StartupThread(SimpleThread* pThread);
extern void ShutdownThread(SimpleThread* pThread);
extern _BOOL SwitchThread(SimpleThread* pThread,_BOOL bSwitch);
extern _BOOL WaitThread(SimpleThread* pThread);
extern _BOOL CheckThreadPulse(SimpleThread* pThread);
extern _STRING GetThreadStatusComment(_UINT32 nStatus);
extern _STRING DumpThread(_STRING lpstrFomrat,SimpleThread* pThread);
////////////////////////////////////////////////////////////////////////////////
#endif //End of the header file.