<commit_before><commit_msg>[LWP] Add Windows Threads files<commit_after>
#pragma once

#include	<windows.h>
#include	<string>

#include	"IThread.h"

namespace	LWP
{

template<typename T> class Thread : public IThread
{
private:
	HANDLE thread_;
	DWORD id_;
	bool isWorking_;
	T function_;

	Thread(void);
	static DWORD WINAPI threadProc(void* t)
	{
		reinterpret_cast<Thread<T>*>(t)->function_();
		return (S_OK);
	}

public:
	Thread(T function) : function_(function)
	{
		this->isWorking_ = false;
	}

	virtual ~Thread(void)
	{
		TerminateThread(this->thread_, 0);
	}

	virtual void launch()
	{
		this->thread_ = CreateThread(0, 0, &Thread::threadProc, this, 0, &this->id_);
		this->isWorking_ = true;
	}

	virtual void join()
	{
		WaitForSingleObject(this->thread_, 0);
	}

	virtual bool isWorking() const
	{
		return (this->isWorking_);
	}
};

}			// namespace LWP
{'fraction_non_alphanumeric': 0.14417531718569782, 'fraction_numerical': 0.0057670126874279125, 'mean_word_length': 4.425, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2324974', 'n_tokens_mistral': 347, 'n_tokens_neox': 320, 'n_words': 74}