summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
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 =