![]() |
hpx::finalize — Main function to gracefully terminate the the HPX runtime system.
// In header: <hpx/hpx_finalize.hpp> int finalize(error_code & ec = throws);
The function hpx::finalize is the main way to (gracefully) exit any HPX application. It should be called from one locality only (usually the console) and it will notify all connected localities to finish execution. Only after all other localities have exited this function will return, allowing to exit the console locality as well.
During the execution of this function the runtime system will invoke all registered shutdown functions (see hpx::init) on all localities.
![]() |
Note |
---|---|
As long as ec is not pre-initialized to hpx::throws this function doesn't throw but returns the result code using the parameter ec. Otherwise it throws an instance of |
This function will block and wait for all connected localities to exit before returning to the caller. It should be the last HPX-function called by any application.
Using this function is an alternative to hpx::disconnect, these functions do not need to be called both.
Parameters: |
|
||
Returns: |
This function will always return zero. |