4.3.9 set_barrier/3

-spec set_barrier(barrier_id(),
                  classy:run_level(), [Option]) -> ok |
                                                   {error,
                                                    deleted |
                                                    badarg} when Option ::
                                                                     monitor |
                                                                     async |
                                                                     {hint,
                                                                      description()}.

This function does the following:

  1. Lowers the run level to the specified one (or less), if the current run level was higher.
  2. Return ok to the caller.
  3. Prevents classy from advancing the run level until classy_boot:rm_barrier/1 is called with the same lock ID.

If async option is present, the function returns immediately without waiting for the level to be adjusted.

If monitor option is present, the barrier is automatically removed when the process that set it terminates.

{hint, Hint} option allows to attach an arbitrary term serving as a hint to the operator explaining what the boot is waiting for.

If the barrier with the same ID already existed, its level and description are updated.

WARNING: with an exception of monitor option, business logic is entirely responsible for removing the barriers.

JavaScript license information