run
mach::App::run
Starts the application.
Description
Section titled “Description”Starts the application and begins accepting incoming HTTP requests.
Syntax
Section titled “Syntax”[[nodiscard]] int run();Return Value
Section titled “Return Value”Returns 0 on success. Returns a non-zero value if the application could not be started or encountered a fatal error.
Preconditions
Section titled “Preconditions”The application must not already be running.
Postconditions
Section titled “Postconditions”When this function returns, the application has stopped accepting new connections and all worker threads have terminated.
Remarks
Section titled “Remarks”- This function blocks the calling thread until the application shuts down.
- Endpoints, middleware, and services should be registered before calling this function.
- The application can be stopped by calling
stop()from another thread.
Thread Safety
Section titled “Thread Safety”This function is not thread-safe and must not be called concurrently.
Example
Section titled “Example”return app.run();See Also
Section titled “See Also”| Name | Description |
|---|---|
stop |
Stops the application. |