(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]]]]
 [\\library
  ["[0]" /]])

(def .public documentation
  (.List $.Documentation)
  (list ($.module /._
                  "")

        ($.definition /.semaphore_is_maxed_out)
        ($.definition /.barrier)

        ($.definition /.Semaphore
          "A tool for controlling access to resources by multiple concurrent processes.")

        ($.definition /.semaphore
          ""
          [(semaphore initial_open_positions)])

        ($.definition /.wait!
          (format "Wait on a semaphore until there are open positions."
                  \n "After finishing your work, you must 'signal' to the semaphore that you're done.")
          [(wait! semaphore)])

        ($.definition /.signal!
          "Signal to a semaphore that you're done with your work, and that there is a new open position."
          [(signal! semaphore)])

        ($.definition /.Mutex
          "A mutual-exclusion lock that can only be acquired by one process at a time.")

        ($.definition /.mutex
          "Creates a brand-new mutex."
          [(mutex _)])

        ($.definition /.synchronize!
          "Runs the procedure with exclusive control of the mutex."
          [(synchronize! mutex procedure)])

        ($.definition /.limit
          "Produce a limit for a barrier.")

        ($.definition /.Limit
          "A limit for barriers.")

        ($.definition /.Barrier
          "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier.")

        ($.definition /.block!
          "Wait on a barrier until all processes have arrived and met the barrier's limit.")
        ))
