zeroc-ice / ice-demos

Sample programs for Ice
https://zeroc.com
GNU General Public License v2.0
323 stars 217 forks source link

Rework "wait for shutdown" #186

Closed bernardnormier closed 1 year ago

bernardnormier commented 1 year ago

This PR reworks the hello Server to "wait for shutdown" using a promise/future.

It's a draft PR because if we decide to adopt this new model for cpp11 servers, we should update all the demos, not just the hello demo.

bentoi commented 1 year ago

I also find the previous setup simpler.

externl commented 1 year ago

I agree that the current code is simpler.

bernardnormier commented 1 year ago

In the existing server boilerplate, main blocks until the communicator shutdown is completed, and various events (Ctrl+C, the shutdown operation) initiate the communicator shutdown.

In this revised version, the Ice runtime is no longer involved in this logic: main blocks until the application calls "requestShutdown", and requestShutdown does not call the Ice runtime.

bentoi commented 1 year ago

In this revised version, the Ice runtime is no longer involved in this logic: main blocks until the application calls "requestShutdown", and requestShutdown does not call the Ice runtime.

But why no longer use waitForShutdown since the runtime still provides it and it's not (yet?) deprecated? If we change this here, we'll have to fix all the demos in all language mappings that use this shutdown pattern. I'd rather revisit this with 3.8.