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();
|
||||
}
|
||||
|
||||
// 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
|
||||
// later. the timer installed by startClient() will take care of
|
||||
// that.
|
||||
|
|
|
@ -721,6 +721,11 @@ ServerApp::mainLoop()
|
|||
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
|
||||
ARCH->setSignalHandler(Arch::kHANGUP, &reloadSignalHandler, NULL);
|
||||
m_events->adoptHandler(m_events->forServerApp().reloadConfig(),
|
||||
|
|
|
@ -201,12 +201,14 @@ EventQueue::adoptBuffer(IEventQueueBuffer* buffer)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
bool
|
||||
EventQueue::parent_requests_shutdown() const
|
||||
{
|
||||
char ch;
|
||||
return m_parentStream.try_read_char(ch) && ch == ShutdownCh;
|
||||
}
|
||||
*/
|
||||
|
||||
bool
|
||||
EventQueue::getEvent(Event& event, double timeout)
|
||||
|
@ -214,10 +216,12 @@ EventQueue::getEvent(Event& event, double timeout)
|
|||
Stopwatch timer(true);
|
||||
retry:
|
||||
// before handling any events make sure we don't need to shutdown
|
||||
/*
|
||||
if (parent_requests_shutdown()) {
|
||||
event = Event(Event::kQuit);
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
// if no events are waiting then handle timers and then wait
|
||||
while (m_buffer->isEmpty()) {
|
||||
// handle timers first
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "base/Stopwatch.h"
|
||||
#include "common/stdmap.h"
|
||||
#include "common/stdset.h"
|
||||
#include "base/NonBlockingStream.h"
|
||||
//#include "base/NonBlockingStream.h"
|
||||
|
||||
#include <queue>
|
||||
|
||||
|
@ -73,7 +73,7 @@ private:
|
|||
bool hasTimerExpired(Event& event);
|
||||
double getNextTimerTimeout() const;
|
||||
void addEventToBuffer(const Event& event);
|
||||
bool parent_requests_shutdown() const;
|
||||
//bool parent_requests_shutdown() const;
|
||||
|
||||
private:
|
||||
class Timer {
|
||||
|
@ -186,7 +186,7 @@ private:
|
|||
Mutex* m_readyMutex;
|
||||
CondVar<bool>* m_readyCondVar;
|
||||
std::queue<Event> m_pending;
|
||||
NonBlockingStream m_parentStream;
|
||||
//NonBlockingStream m_parentStream;
|
||||
};
|
||||
|
||||
#define EVENT_TYPE_ACCESSOR(type_) \
|
||||
|
|
Loading…
Reference in New Issue