Documentation

Hale.TimeManager.System.TimeManager

State of a timeout handle.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      A timeout handle for a single connection. $$\text{Handle} = \text{IO.Ref}(\text{HandleState})$$

      Instances For

        The timeout manager. Periodically checks all registered handles. $$\text{Manager} = \{ \text{timeout} : \mathbb{N},\; \text{handles} : \text{IO.Ref}(\text{Array}(\text{Handle})) \}$$

        Instances For
          def System.TimeManager.Manager.new (timeoutUs : Nat := 30000000) :

          Initialize a new timeout manager with the given timeout (microseconds). Starts a background sweep task on a dedicated OS thread. $$\text{initialize} : \mathbb{N} \to \text{IO}(\text{Manager})$$

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Register a new connection with the manager. Returns a handle for managing its timeout. $$\text{register} : \text{Manager} \to \text{IO}(\text{Unit}) \to \text{IO}(\text{Handle})$$

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Stop the manager's background sweep. The background task will exit after the current sleep interval completes.

              Equations
              Instances For

                Reset the timeout for this handle (called on activity). $$\text{tickle} : \text{Handle} \to \text{Manager} \to \text{IO}(\text{Unit})$$

                Equations
                Instances For

                  Cancel this handle's timeout. It will never fire. $$\text{cancel} : \text{Handle} \to \text{IO}(\text{Unit})$$

                  Equations
                  Instances For

                    Pause the timeout. The handle won't expire until resumed. $$\text{pause} : \text{Handle} \to \text{IO}(\text{Unit})$$

                    Equations
                    Instances For

                      Resume a paused handle with a fresh deadline. $$\text{resume} : \text{Handle} \to \text{Manager} \to \text{IO}(\text{Unit})$$

                      Equations
                      Instances For