mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Replace SimpleThread by JThread now implementing same features
This commit is contained in:
parent
9772322613
commit
e9e9fd7c3f
9 changed files with 30 additions and 88 deletions
|
@ -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 =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue