You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
820 B
C++
57 lines
820 B
C++
#pragma once
|
|
|
|
#include <thread>
|
|
#include <iostream>
|
|
|
|
enum STATES
|
|
{
|
|
IDLE,
|
|
POWERUP,
|
|
AUTO,
|
|
MAINTENANCE
|
|
};
|
|
|
|
|
|
class new_thread {
|
|
|
|
public:
|
|
void operator()(const int x)
|
|
{
|
|
for (int i = 0; i < x; i++)
|
|
{
|
|
std::cout << "Thread ID : " << std::this_thread::get_id() << std::endl;
|
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
}
|
|
|
|
std::cout << "End Of Thread" << std::endl;
|
|
}
|
|
};
|
|
|
|
class Run
|
|
{
|
|
public :
|
|
// ctor
|
|
Run(int count = 1);
|
|
virtual ~Run();
|
|
|
|
|
|
virtual void Maintenance();
|
|
|
|
virtual void Auto();
|
|
virtual void PowerUp();
|
|
|
|
void DoTask();
|
|
void setState(STATES s);
|
|
void EndTask();
|
|
|
|
void WaitThreadTerminate();
|
|
|
|
private:
|
|
|
|
std::thread m_myThread;
|
|
bool m_bExit;
|
|
bool m_bHalt;
|
|
int m_state;
|
|
};
|
|
|