summaryrefslogtreecommitdiff
path: root/src/thread/thread.h
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2019-03-17 01:59:46 +0100
committerMichael Lutz <michi@icosahedron.de>2019-04-06 11:27:39 +0200
commit05bc2ed7cbe07cb4cd535932f10778b35f72e944 (patch)
tree0faaf12fd1bafb0786236ffc82052e8b83dfca60 /src/thread/thread.h
parent05f4e7360886e36b221ef5c3af4426625a3de686 (diff)
downloadopenttd-05bc2ed7cbe07cb4cd535932f10778b35f72e944.tar.xz
Codechange: Replace custom thread code with C++11 thread objects.
We assume a conforming C++11 compiler environment that has a valid <thread>-header. Failure to run a real thread is handled gracefully.
Diffstat (limited to 'src/thread/thread.h')
-rw-r--r--src/thread/thread.h59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/thread/thread.h b/src/thread/thread.h
deleted file mode 100644
index eca825e25..000000000
--- a/src/thread/thread.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id$ */
-
-/*
- * This file is part of OpenTTD.
- * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
- * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** @file thread.h Base of all threads. */
-
-#ifndef THREAD_H
-#define THREAD_H
-
-/** Definition of all thread entry functions. */
-typedef void (*OTTDThreadFunc)(void *);
-
-/** Signal used for signalling we knowingly want to end the thread. */
-class OTTDThreadExitSignal { };
-
-/**
- * A Thread Object which works on all our supported OSes.
- */
-class ThreadObject {
-public:
- /**
- * Virtual destructor to allow 'delete' operator to work properly.
- */
- virtual ~ThreadObject() {};
-
- /**
- * Exit this thread.
- */
- virtual bool Exit() = 0;
-
- /**
- * Join this thread.
- */
- virtual void Join() = 0;
-
- /**
- * Create a thread; proc will be called as first function inside the thread,
- * with optional params.
- * @param proc The procedure to call inside the thread.
- * @param param The params to give with 'proc'.
- * @param thread Place to store a pointer to the thread in. May be NULL.
- * @param name A name for the thread. May be NULL.
- * @return True if the thread was started correctly.
- */
- static bool New(OTTDThreadFunc proc, void *param, ThreadObject **thread = NULL, const char *name = NULL);
-};
-
-/**
- * Get number of processor cores in the system, including HyperThreading or similar.
- * @return Total number of processor cores.
- */
-uint GetCPUCoreCount();
-
-#endif /* THREAD_H */