Another useful reconfiguration combinator is one that adds a new behavior to a running process. To do that, we define a process extend that executes a process p_init and awaits new processes to execute on a signal add_behavior. The initial process p_init and the added processes will share a common state state.

let rec process extend p_init state add_behavior =
  run (p_init state)
  ||
  await add_behavior (p) in
  run (extend p state add_behavior)

In this process, p_init is executed and in parallel a process p is awaited on the signal add_behavior. When p is received, it is executed through a recursive call to extend so that it is still possible to add new behaviors.