<commit_before>#include "Thread/Unix/ThreadImpl.hh"
#include "Thread/ThreadException.hh"

namespace LilWrapper
{
  ThreadImpl::ThreadImpl(Thread *thread)
  {
    this->_isActive = pthread_create(&this->_thread, NULL,
	&ThreadImpl::entryPoint, thread) == 0;
    if (!this->_isActive)
      throw ThreadException("Thread Exception: "
	  "Error while creating the Thread.");
  }

  ThreadImpl::~ThreadImpl()
  {
    if (this->_isActive)
      terminate();
  }

  void ThreadImpl::wait()
  {
    if (this->_isActive)
    {
      if (pthread_equal(pthread_self(), this->_thread) != 0)
	throw ThreadException("Thread Exception: "
	    "A thread cannot wait for itself.");
      pthread_join(this->_thread, NULL);
    }
  }

  void ThreadImpl::terminate()
  {
    if (this->_isActive)
      pthread_cancel(this->_thread);
  }

  void *ThreadImpl::entryPoint(void *data)
  {<commit_msg>Set the Thread as inactive when terminating it.<commit_after>#include "Thread/Unix/ThreadImpl.hh"
#include "Thread/ThreadException.hh"

namespace LilWrapper
{
  ThreadImpl::ThreadImpl(Thread *thread)
  {
    this->_isActive = pthread_create(&this->_thread, NULL,
        &ThreadImpl::entryPoint, thread) == 0;
    if (!this->_isActive)
      throw ThreadException("Thread Exception: "
          "Error while creating the Thread.");
  }

  ThreadImpl::~ThreadImpl()
  {
    if (this->_isActive)
      terminate();
  }

  void ThreadImpl::wait()
  {
    if (this->_isActive)
    {
      if (pthread_equal(pthread_self(), this->_thread) != 0)
        throw ThreadException("Thread Exception: "
            "A thread cannot wait for itself.");
      pthread_join(this->_thread, NULL);
    }
  }

  void ThreadImpl::terminate()
  {
    if (this->_isActive)
      pthread_cancel(this->_thread);
    this->_isActive = false;
  }

  void *ThreadImpl::entryPoint(void *data)
  {
{'fraction_non_alphanumeric': 0.14022739577693558, 'fraction_numerical': 0.002165674066053059, 'mean_word_length': 3.3895486935866983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '5807092', 'n_tokens_mistral': 593, 'n_tokens_neox': 578, 'n_words': 121}