1 /* $Id: thread_none.cpp 26349 2014-02-16 21:37:05Z frosch $ */
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file thread_none.cpp No-Threads-Available implementation of Threads */
12 #include "../stdafx.h"
15 #include "../safeguards.h"
17 /* static */ bool ThreadObject::New(OTTDThreadFunc proc
, void *param
, ThreadObject
**thread
, const char *name
)
19 if (thread
!= NULL
) *thread
= NULL
;
23 /** Mutex that doesn't do locking because it ain't needed when there're no threads */
24 class ThreadMutex_None
: public ThreadMutex
{
26 virtual void BeginCritical(bool allow_recursive
= false) {}
27 virtual void EndCritical(bool allow_recursive
= false) {}
28 virtual void WaitForSignal() {}
29 virtual void SendSignal() {}
32 /* static */ ThreadMutex
*ThreadMutex::New()
34 return new ThreadMutex_None();