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.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../thread/thread.h"
|
||||
#include "../../thread.h"
|
||||
|
||||
#include "tcp.h"
|
||||
|
||||
@@ -33,7 +33,7 @@ TCPConnecter::TCPConnecter(const NetworkAddress &address) :
|
||||
address(address)
|
||||
{
|
||||
_tcp_connecters.push_back(this);
|
||||
if (!ThreadObject::New(TCPConnecter::ThreadEntry, this, &this->thread, "ottd:tcp")) {
|
||||
if (!StartNewThread(NULL, "ottd:tcp", &TCPConnecter::ThreadEntry, this)) {
|
||||
this->Connect();
|
||||
}
|
||||
}
|
||||
@@ -53,9 +53,9 @@ void TCPConnecter::Connect()
|
||||
* Entry point for the new threads.
|
||||
* @param param the TCPConnecter instance to call Connect on.
|
||||
*/
|
||||
/* static */ void TCPConnecter::ThreadEntry(void *param)
|
||||
/* static */ void TCPConnecter::ThreadEntry(TCPConnecter *param)
|
||||
{
|
||||
static_cast<TCPConnecter*>(param)->Connect();
|
||||
param->Connect();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user