mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-18 18:55:29 +02:00
Replace SimpleThread by JThread now implementing same features
This commit is contained in:
@@ -59,53 +59,9 @@ private:
|
||||
JMutex m_mutex;
|
||||
};
|
||||
|
||||
/*
|
||||
A base class for simple background thread implementation
|
||||
*/
|
||||
|
||||
class SimpleThread : public JThread
|
||||
{
|
||||
bool run;
|
||||
JMutex run_mutex;
|
||||
|
||||
public:
|
||||
|
||||
SimpleThread():
|
||||
JThread(),
|
||||
run(true)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~SimpleThread()
|
||||
{}
|
||||
|
||||
virtual void * Thread() = 0;
|
||||
|
||||
bool getRun()
|
||||
{
|
||||
JMutexAutoLock lock(run_mutex);
|
||||
return run;
|
||||
}
|
||||
void setRun(bool a_run)
|
||||
{
|
||||
JMutexAutoLock lock(run_mutex);
|
||||
run = a_run;
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
setRun(false);
|
||||
while(IsRunning())
|
||||
sleep_ms(100);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
A single worker thread - multiple client threads queue framework.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
template<typename Key, typename T, typename Caller, typename CallerData>
|
||||
class GetResult
|
||||
{
|
||||
|
Reference in New Issue
Block a user