fractalide / fractalide-oz

Proof of concept
GNU Affero General Public License v3.0
12 stars 3 forks source link

clean shutdown #63

Closed dmichiels closed 9 years ago

dmichiels commented 10 years ago

A lacking feature is the clean shutdown of a graph.

Some ideas :

The component can be gracefully stopped if they received the "nil" message, as they can receive bind, unbound, start, send, ... This will stop the foldl loop, then stop the thread, and then stop the component.

If all the components are stopped, the Oz VM will also stop. A first simple implementation will to add a procedure /shutdown/ in graph.oz. It will send nil to all components.

There still a problem if we want to stop the graph with a component. A first idea I see is to give the graph record to a component as options, in launcher.oz. Then, bind the output port of the card to the input port of the /shutdown/ component. But what if the graph loaded is not a card?

sjmackenzie commented 10 years ago

I don't fully understand what FBP level means. Is that launcher.oz? But logically speaking if the starting of the program is initiated by launcher.oz then surely the shutdown procedure should be initiated from that point? This then proliferates to graph level that sets about shutting down every component it is aware of. Then shuts down the graph, then launcher.oz cleanly shuts down the mvm.

The problem is that the sequence should be initiated by a shutdown component hooked up to a 'exit' button somewhere as part of the running program.

Could we not code up a shutdown component which is hard coded to send a signal to launcher.oz via a port? This way if folks want to shutdown they just pull in this shutdown component and then launcher takes over the shutdown sequence?

dmichiels commented 10 years ago

yes, your proposition is what I try to explain, but in better words! We need a component that can shutdown the running graph.

sjmackenzie commented 10 years ago

Ah okay!

Yes I agree with your design. ;-)