52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#ifndef __Thread_h__
|
|
#define __Thread_h__
|
|
|
|
#include "includes"
|
|
#include "Log.h"
|
|
#include "Object.h"
|
|
#include "Session.h"
|
|
|
|
namespace core {
|
|
|
|
class EPoll;
|
|
|
|
///
|
|
/// Thread
|
|
///
|
|
/// This thread object is designed to be the thread processor for the EPoll object. It wraps the thread
|
|
/// object to allow maintaining a status value for monitoring the thread activity. EPoll will instantiate
|
|
/// a Thread object for each thread specified in the EPoll's start method.
|
|
///
|
|
|
|
class Thread : public Object {
|
|
|
|
public:
|
|
Thread(EPoll &ePoll);
|
|
~Thread();
|
|
|
|
///
|
|
/// Start the thread object. This will cause the epoll scheduler to commence reading the epoll queue.
|
|
///
|
|
|
|
void start();
|
|
void join();
|
|
std::string getStatus();
|
|
pid_t getThreadId();
|
|
int getCount();
|
|
void output(Session *session);
|
|
|
|
private:
|
|
EPoll &ePoll; // The EPoll control object.
|
|
std::string status;
|
|
int count;
|
|
std::thread *_thread;
|
|
void print_thread_start_log();
|
|
pid_t threadId;
|
|
void run();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|