We can also combine the operators in another way. First we run an extensible process.
#run extend moving_point (new_state ()) add_behavior ;;
and then we add a behavior which is killable.
emit add_behavior (fun state -> process (run (killable (up_down state)))) ;;
You can see that the behavior of two moving points have been modified
because two processes are waiting on the
signal add_behavior
. The two processes execute a new
killable behavior in parallel to their previous behavior and thus the
id of two killable processes are printed into the terminal. We can now
kill these processes.
emit to_kill 3 ;;
emit to_kill 4 ;;
Note that the two moving points that were modified still exist because we only killed the added behaviors.