ConOpSys V2970  P004.07
ANVILEX control operating system
Thread.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Description : ConOS-Kernel / Thread implementation
3 // Filename : Thread.h
4 // Biuld : V1.0
5 // Date : 30.10.2003
6 // Copyright : 2002, 2003 Konstantin Minch
7 //------------------------------------------------------------------------------
8 
9 #pragma once
10 
11 //--- Include headers ----------------------------------------------------------
12 
13 #include "Define.h"
14 
15 //--- Define log capability ----------------------------------------------------
16 
17 #ifdef LOGGER
18 //#define THREAD_LOGGING
19 #endif
20 
21 //--- Defines ------------------------------------------------------------------
22 
23 #define THREAD_MIN_STACK_SIZE 0x400 // Minimal stack size of the thread
24 
25 //--- Class TThread ------------------------------------------------------------
26 
27 class TThread
28 {
29 
30 
31  //----------------------------------------------------------------------------
32  //
33  //----------------------------------------------------------------------------
34 
35  public:
36 
38 
39  TThread( U32 ThreadStackSize, U32 ThreadInterruptLevel, TThreadPriority ThreadPriority ); // Constructor
40  ~TThread(); // Destructor
41  VOID Resume(); // Resume thread
42  VOID Suspend(); // Suspend thread
43  VOID Initialize(); // Init thread
44  virtual VOID Thread(); // Thread implementation
45 
46  TThreadPriority Priority; // Priority flag
47  U32 Prescaler; // Timer prescaler
48  VOID *BackupedStack; // Backuped stack pointer
49  VOID *Stack; // Stack pointer of the thread
50 
51  BOOL NeedToActivate; // Need to start thread
52  BOOL NeedToDestroy; // Need to destroy thread
53 
54  //----------------------------------------------------------------------------
55  //
56  //----------------------------------------------------------------------------
57 
58  protected:
59 
60  //----------------------------------------------------------------------------
61  //
62  //----------------------------------------------------------------------------
63 
64  private:
65 
66  U32 InterruptLevel; // Interrupt level
67  VOID *EntryPoint; // Thread entry point
68  U32 StackSize; // Stack size
69  BOOL Suspended; // Suspended flag
70 
71 };
72 
73 //------------------------------------------------------------------------------
74 // End of file
75 //------------------------------------------------------------------------------
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
Definition: Thread.h:28
TThreadPriority Priority
Definition: Thread.h:46
VOID Initialize()
Definition: Thread.cpp:119
virtual VOID Thread()
Definition: Thread.cpp:137
TThread(U32 ThreadStackSize, U32 ThreadInterruptLevel, TThreadPriority ThreadPriority)
Definition: Thread.cpp:64
~TThread()
Definition: Thread.cpp:99
VOID Suspend()
Definition: Thread.cpp:150
TThreadPriority
Definition: Thread.h:37
@ prIdle
Definition: Thread.h:37
@ prHigh
Definition: Thread.h:37
@ prLow
Definition: Thread.h:37
@ prNormal
Definition: Thread.h:37
@ prRealtime
Definition: Thread.h:37
BOOL NeedToDestroy
Definition: Thread.h:52
VOID Resume()
Definition: Thread.cpp:160
U32 InterruptLevel
Definition: Thread.h:66
VOID * BackupedStack
Definition: Thread.h:48
VOID * EntryPoint
Definition: Thread.h:67
VOID * Stack
Definition: Thread.h:49
U32 Prescaler
Definition: Thread.h:47
BOOL NeedToActivate
Definition: Thread.h:51
BOOL Suspended
Definition: Thread.h:69
U32 StackSize
Definition: Thread.h:68