#include "stdafx.h"
#include "CThread.h"

CThread::CThread()
{
}

CThread::~CThread()
{
	if (!this->isInterrupted())
	{
		this->interrupt();
	}

	if (this->th.joinable()) {
		this->th.join();
	}
}

void CThread::start()
{
	std::thread thr(std::bind(&CThread::run, this));
	this->th = std::move(thr);
}

std::thread::id CThread::getId()
{
    return this->th.get_id();
}

void CThread::interrupt()
{
	this->isInterript;
}

bool CThread::isInterrupted()
{
    return false;
}

void CThread::join()
{
	this->th.join();
}

void CThread::run()
{
}
