<commit_before>/*
  Adventure Game Studio

  Copyright 1999 - 2011 <NAME>.
  Copyright 2012 by various contributers.
  All rights reserved.

  The AGS source code is provided under the Artistic License 2.0
  http://www.opensource.org/licenses/artistic-license-2.0.php

  You MAY NOT compile your own builds of the engine without making it EXPLICITLY
  CLEAR that the code has been altered from the Standard Version.
*/

#ifndef __AGS_EE_PLATFORM__THREAD_PTHREAD_H
#define __AGS_EE_PLATFORM__THREAD_PTHREAD_H

#include <pthread.h>

namespace AGS
{
namespace Engine
{


class PThreadThread : public BaseThread
{
public:
  PThreadThread()
  {
    _running = false;
  }

  ~PThreadThread()
  {
    Stop();
  }

  inline bool Create(AGSThreadEntry entryPoint, bool looping)
  {
    _looping = looping;
    _entry = entryPoint;

    // Thread creation is delayed till the thread is started
    return true;
  }

  inline bool Start()
  {
    if (!_running)
    {
      _running = (pthread_create(&_thread, NULL, _thread_start, this) != 0);

      return _running;
    }
    else<commit_msg>Engine: Fixed pthread thread creation return value.<commit_after>/*
  Adventure Game Studio

  Copyright 1999 - 2011 <NAME>.
  Copyright 2012 by various contributers.
  All rights reserved.

  The AGS source code is provided under the Artistic License 2.0
  http://www.opensource.org/licenses/artistic-license-2.0.php

  You MAY NOT compile your own builds of the engine without making it EXPLICITLY
  CLEAR that the code has been altered from the Standard Version.
*/

#ifndef __AGS_EE_PLATFORM__THREAD_PTHREAD_H
#define __AGS_EE_PLATFORM__THREAD_PTHREAD_H

#include <pthread.h>

namespace AGS
{
namespace Engine
{


class PThreadThread : public BaseThread
{
public:
  PThreadThread()
  {
    _running = false;
  }

  ~PThreadThread()
  {
    Stop();
  }

  inline bool Create(AGSThreadEntry entryPoint, bool looping)
  {
    _looping = looping;
    _entry = entryPoint;

    // Thread creation is delayed till the thread is started
    return true;
  }

  inline bool Start()
  {
    if (!_running)
    {
      _running = (pthread_create(&_thread, NULL, _thread_start, this) == 0);

      return _running;
    }
    else
{'fraction_non_alphanumeric': 0.0770625566636446, 'fraction_numerical': 0.015412511332728921, 'mean_word_length': 3.310546875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4304397', 'n_tokens_mistral': 746, 'n_tokens_neox': 694, 'n_words': 221}