event/Loop: inline field initializers

This commit is contained in:
Max Kellermann
2020-12-01 20:07:04 +01:00
parent 5f2797e7cc
commit ef8797821f
2 changed files with 4 additions and 7 deletions

View File

@@ -46,18 +46,15 @@ EventLoop::EventLoop(
ThreadId _thread ThreadId _thread
#endif #endif
) )
:
#ifdef HAVE_THREADED_EVENT_LOOP #ifdef HAVE_THREADED_EVENT_LOOP
wake_event(*this, BIND_THIS_METHOD(OnSocketReady)), :thread(_thread),
thread(_thread),
/* if this instance is hosted by an EventThread (no ThreadId /* if this instance is hosted by an EventThread (no ThreadId
known yet) then we're not yet alive until the thread is known yet) then we're not yet alive until the thread is
started; for the main EventLoop instance, we assume it's started; for the main EventLoop instance, we assume it's
already alive, because nobody but EventThread will call already alive, because nobody but EventThread will call
SetAlive() */ SetAlive() */
alive(!_thread.IsNull()), alive(!_thread.IsNull())
#endif #endif
quit(false)
{ {
#ifdef HAVE_THREADED_EVENT_LOOP #ifdef HAVE_THREADED_EVENT_LOOP
wake_event.Open(SocketDescriptor(wake_fd.Get())); wake_event.Open(SocketDescriptor(wake_fd.Get()));

View File

@@ -63,7 +63,7 @@ class EventLoop final
{ {
#ifdef HAVE_THREADED_EVENT_LOOP #ifdef HAVE_THREADED_EVENT_LOOP
WakeFD wake_fd; WakeFD wake_fd;
SocketEvent wake_event; SocketEvent wake_event{*this, BIND_THIS_METHOD(OnSocketReady)};
#endif #endif
struct TimerCompare { struct TimerCompare {
@@ -132,7 +132,7 @@ class EventLoop final
bool alive; bool alive;
#endif #endif
std::atomic_bool quit; std::atomic_bool quit{false};
/** /**
* True when the object has been modified and another check is * True when the object has been modified and another check is