Skip to content

Commit

Permalink
don't sync to client event service at exit when in desktop mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Mar 4, 2011
1 parent bbcfef9 commit a029d2e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/cpp/session/SessionMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1338,12 +1338,19 @@ void rCleanup(bool terminatedNormally)
// fire shutdown event to modules
module_context::events().onShutdown(terminatedNormally);

// cause graceful exit of clientEventService (ensures delivery
// of any pending events prior to process termination). wait a
// very brief interval first to allow the quit or other termination
// related events to get into the queue
// wait a bit to allow clientEventService to deliver any pending
// events (e.g. quit or suspend) prior to process termination.
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
clientEventService().stop();

// if we in server mode then explicitly stop the clientEventService
// this will do a join of the event service thread which will
// allow a bit of extra time for a slow client connection to
// connect and get the events. note that on desktop mode we also
// had a strong crashing problem during stop() on OSX, and there
// really isn't a need for a synced stop on the desktop since
// client termination will be handled automatically
if (session::options().programMode() == kSessionProgramModeServer)
clientEventService().stop();

// stop the main http listener
httpConnectionListener().stop();
Expand Down

0 comments on commit a029d2e

Please sign in to comment.