event/Thread: remove the Mutex
We don't need to access Thread::handle early inside the EventThread, so we don't need this trick anymore.
This commit is contained in:
parent
5e081de14a
commit
9324fbf921
@ -26,7 +26,6 @@ EventThread::Start()
|
|||||||
{
|
{
|
||||||
assert(!thread.IsDefined());
|
assert(!thread.IsDefined());
|
||||||
|
|
||||||
const std::lock_guard<Mutex> protect(mutex);
|
|
||||||
thread.Start(ThreadFunc, this);
|
thread.Start(ThreadFunc, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,11 +43,6 @@ EventThread::ThreadFunc()
|
|||||||
{
|
{
|
||||||
SetThreadName("io");
|
SetThreadName("io");
|
||||||
|
|
||||||
/* lock+unlock to synchronize with io_thread_start(), to be
|
|
||||||
sure that io.thread is set */
|
|
||||||
mutex.lock();
|
|
||||||
mutex.unlock();
|
|
||||||
|
|
||||||
event_loop.Run();
|
event_loop.Run();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,14 +23,11 @@
|
|||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "Loop.hxx"
|
#include "Loop.hxx"
|
||||||
#include "thread/Thread.hxx"
|
#include "thread/Thread.hxx"
|
||||||
#include "thread/Mutex.hxx"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A thread which runs an #EventLoop.
|
* A thread which runs an #EventLoop.
|
||||||
*/
|
*/
|
||||||
class EventThread final {
|
class EventThread final {
|
||||||
Mutex mutex;
|
|
||||||
|
|
||||||
EventLoop event_loop;
|
EventLoop event_loop;
|
||||||
|
|
||||||
Thread thread;
|
Thread thread;
|
||||||
|
Loading…
Reference in New Issue
Block a user