aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-12-03 23:32:03 +0100
committersapier <Sapier at GMX dot net>2013-12-15 13:39:42 +0100
commite9e9fd7c3f12bc5119b567ad37527d777859dbc0 (patch)
treecc3eb08bf696444ae6bea4a0cfe2cf29f66b56be /src/server.cpp
parent977232261388fa80bd6ab3bb849ae4d7a8ade73e (diff)
downloadminetest-e9e9fd7c3f12bc5119b567ad37527d777859dbc0.tar.gz
minetest-e9e9fd7c3f12bc5119b567ad37527d777859dbc0.tar.bz2
minetest-e9e9fd7c3f12bc5119b567ad37527d777859dbc0.zip
Replace SimpleThread by JThread now implementing same features
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 1455de721..c1cedf0f3 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -73,14 +73,14 @@ public:
{}
};
-class ServerThread : public SimpleThread
+class ServerThread : public JThread
{
Server *m_server;
public:
ServerThread(Server *server):
- SimpleThread(),
+ JThread(),
m_server(server)
{
}
@@ -98,7 +98,7 @@ void * ServerThread::Thread()
BEGIN_DEBUG_EXCEPTION_HANDLER
- while(getRun())
+ while(!StopRequested())
{
try{
//TimeTaker timer("AsyncRunStep() + Receive()");
@@ -963,14 +963,13 @@ void Server::start(unsigned short port)
infostream<<"Starting server on port "<<port<<"..."<<std::endl;
// Stop thread if already running
- m_thread->stop();
+ m_thread->Stop();
// Initialize connection
m_con.SetTimeoutMs(30);
m_con.Serve(port);
// Start thread
- m_thread->setRun(true);
m_thread->Start();
// ASCII art for the win!
@@ -993,9 +992,9 @@ void Server::stop()
infostream<<"Server: Stopping and waiting threads"<<std::endl;
// Stop threads (set run=false first so both start stopping)
- m_thread->setRun(false);
+ m_thread->Stop();
//m_emergethread.setRun(false);
- m_thread->stop();
+ m_thread->Wait();
//m_emergethread.stop();
infostream<<"Server: Threads stopped"<<std::endl;
@@ -1682,7 +1681,7 @@ void Server::AsyncRunStep()
{
counter = 0.0;
- m_emerge->triggerAllThreads();
+ m_emerge->startAllThreads();
// Update m_enable_rollback_recording here too
m_enable_rollback_recording =