Normalise threading support checking into a single #define
This commit is contained in:
parent
c30125111a
commit
957bb5c0f2
|
@ -20,7 +20,7 @@
|
|||
#include "cppcheck.h"
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#if (defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)
|
||||
#ifdef THREADING_MODEL_FORK
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -34,7 +34,7 @@
|
|||
ThreadExecutor::ThreadExecutor(const std::vector<std::string> &filenames, Settings &settings, ErrorLogger &errorLogger)
|
||||
: _filenames(filenames), _settings(settings), _errorLogger(errorLogger), _fileCount(0)
|
||||
{
|
||||
#if (defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)
|
||||
#ifdef THREADING_MODEL_FORK
|
||||
_pipe[0] = _pipe[1] = 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ void ThreadExecutor::addFileContent(const std::string &path, const std::string &
|
|||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
////// This code is for __GNUC__ and __sun only ///////////////////////////////
|
||||
////// This code is for platforms that support fork() only ////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if (defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)
|
||||
#ifdef THREADING_MODEL_FORK
|
||||
|
||||
int ThreadExecutor::handleRead(unsigned int &result)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include "settings.h"
|
||||
#include "errorlogger.h"
|
||||
|
||||
#if (defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)
|
||||
#define THREADING_MODEL_FORK
|
||||
#endif
|
||||
|
||||
/// @addtogroup CLI
|
||||
/// @{
|
||||
|
||||
|
@ -59,7 +63,7 @@ private:
|
|||
/** @brief Key is file name, and value is the content of the file */
|
||||
std::map<std::string, std::string> _fileContents;
|
||||
|
||||
#if (defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)
|
||||
#ifdef THREADING_MODEL_FORK
|
||||
private:
|
||||
/**
|
||||
* Read from the pipe, parse and handle what ever is in there.
|
||||
|
|
Loading…
Reference in New Issue