zeroc-ice / ice-demos

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

Improve termination of Swift servants in response to signals #75

Open pepone opened 5 years ago

pepone commented 5 years ago

The pattern used in IceStorm/clock subscriber, isn't simple and also is not thread safe, there is a chance for exit call run when GDC global queue is still releasing the communicator reference in the signal event handler

https://github.com/zeroc-ice/ice-demos/blob/d3d8881d3e2351a6a196be29c16cd7aaaa4e63a0/swift/IceStorm/clock/Sources/Subscriber/main.swift#L41-L48

For the publisher we do all the work in the main thread including the signal handling, but it is still not straightforward and will be good if we come up with a better solution

https://github.com/zeroc-ice/ice-demos/blob/d3d8881d3e2351a6a196be29c16cd7aaaa4e63a0/swift/IceStorm/clock/Sources/Publisher/main.swift#L35-L45