mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Replace SimpleThread by JThread now implementing same features
This commit is contained in:
@@ -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 =
|
||||
|
Reference in New Issue
Block a user