Enable new StdinListen and disable old stdin reading code
This commit is contained in:
parent
b3c5a79aef
commit
c67ad71c90
|
@ -455,6 +455,11 @@ ClientApp::mainLoop()
|
||||||
initIpcClient();
|
initIpcClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup polling for stdin if not running in daemon mode
|
||||||
|
if (!argsBase().m_daemon) {
|
||||||
|
initStdinListen();
|
||||||
|
}
|
||||||
|
|
||||||
// run event loop. if startClient() failed we're supposed to retry
|
// run event loop. if startClient() failed we're supposed to retry
|
||||||
// later. the timer installed by startClient() will take care of
|
// later. the timer installed by startClient() will take care of
|
||||||
// that.
|
// that.
|
||||||
|
|
|
@ -721,6 +721,11 @@ ServerApp::mainLoop()
|
||||||
initIpcClient();
|
initIpcClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup polling for stdin if not running in daemon mode
|
||||||
|
if (!argsBase().m_daemon) {
|
||||||
|
initStdinListen();
|
||||||
|
}
|
||||||
|
|
||||||
// handle hangup signal by reloading the server's configuration
|
// handle hangup signal by reloading the server's configuration
|
||||||
ARCH->setSignalHandler(Arch::kHANGUP, &reloadSignalHandler, NULL);
|
ARCH->setSignalHandler(Arch::kHANGUP, &reloadSignalHandler, NULL);
|
||||||
m_events->adoptHandler(m_events->forServerApp().reloadConfig(),
|
m_events->adoptHandler(m_events->forServerApp().reloadConfig(),
|
||||||
|
|
|
@ -201,12 +201,14 @@ EventQueue::adoptBuffer(IEventQueueBuffer* buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
bool
|
bool
|
||||||
EventQueue::parent_requests_shutdown() const
|
EventQueue::parent_requests_shutdown() const
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
return m_parentStream.try_read_char(ch) && ch == ShutdownCh;
|
return m_parentStream.try_read_char(ch) && ch == ShutdownCh;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
EventQueue::getEvent(Event& event, double timeout)
|
EventQueue::getEvent(Event& event, double timeout)
|
||||||
|
@ -214,10 +216,12 @@ EventQueue::getEvent(Event& event, double timeout)
|
||||||
Stopwatch timer(true);
|
Stopwatch timer(true);
|
||||||
retry:
|
retry:
|
||||||
// before handling any events make sure we don't need to shutdown
|
// before handling any events make sure we don't need to shutdown
|
||||||
|
/*
|
||||||
if (parent_requests_shutdown()) {
|
if (parent_requests_shutdown()) {
|
||||||
event = Event(Event::kQuit);
|
event = Event(Event::kQuit);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// if no events are waiting then handle timers and then wait
|
// if no events are waiting then handle timers and then wait
|
||||||
while (m_buffer->isEmpty()) {
|
while (m_buffer->isEmpty()) {
|
||||||
// handle timers first
|
// handle timers first
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "base/Stopwatch.h"
|
#include "base/Stopwatch.h"
|
||||||
#include "common/stdmap.h"
|
#include "common/stdmap.h"
|
||||||
#include "common/stdset.h"
|
#include "common/stdset.h"
|
||||||
#include "base/NonBlockingStream.h"
|
//#include "base/NonBlockingStream.h"
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ private:
|
||||||
bool hasTimerExpired(Event& event);
|
bool hasTimerExpired(Event& event);
|
||||||
double getNextTimerTimeout() const;
|
double getNextTimerTimeout() const;
|
||||||
void addEventToBuffer(const Event& event);
|
void addEventToBuffer(const Event& event);
|
||||||
bool parent_requests_shutdown() const;
|
//bool parent_requests_shutdown() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Timer {
|
class Timer {
|
||||||
|
@ -186,7 +186,7 @@ private:
|
||||||
Mutex* m_readyMutex;
|
Mutex* m_readyMutex;
|
||||||
CondVar<bool>* m_readyCondVar;
|
CondVar<bool>* m_readyCondVar;
|
||||||
std::queue<Event> m_pending;
|
std::queue<Event> m_pending;
|
||||||
NonBlockingStream m_parentStream;
|
//NonBlockingStream m_parentStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define EVENT_TYPE_ACCESSOR(type_) \
|
#define EVENT_TYPE_ACCESSOR(type_) \
|
||||||
|
|
Loading…
Reference in New Issue