hpx::disconnect#

Defined in header hpx/init.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

See also:

int hpx::disconnect(hpx::error_code &ec = throws)#

Disconnect this locality from the application.

The function hpx::disconnect can be used to disconnect a locality from a running HPX application.

During the execution of this function the runtime system will invoke all registered shutdown functions (see hpx::init) on this locality.

This function will not wait for this locality to finish executing, rather it informs this locality that it should disconnect whenever there is no more work to be done.

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 hpx::exception.

Parameters:

ec – [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

Returns:

This function will always return zero if successful, -1 otherwise.

int hpx::disconnect(hpx::chrono::steady_duration shutdown_timeout, hpx::error_code &ec = throws)#

Disconnect this locality from the application.

The function hpx::disconnect can be used to disconnect a locality from a running HPX application.

During the execution of this function the runtime system will invoke all registered shutdown functions (see hpx::init) on this locality.

Any std::chrono::duration is implicitly convertible to hpx::chrono::steady_duration, e.g. hpx::disconnect(std::chrono::seconds(60)). Pass the timeout explicitly to use it; call the overload taking no arguments to use the globally configured default (see configuration parameter hpx.shutdown_timeout).

This function will not wait for this locality to finish executing, rather it informs this locality that it should disconnect whenever there is no more work to be done.

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 hpx::exception.

Parameters:
  • shutdown_timeout – This parameter allows to specify a timeout, specifying how long this locality should wait for pending tasks to be executed. After this timeout, all suspended HPX-threads will be aborted. Note, that this function will not abort any running HPX-threads. In any case the shutdown will not proceed as long as there is at least one pending/running HPX-thread.

  • ec – [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

Returns:

This function will always return zero.

int hpx::disconnect(double shutdown_timeout, double localwait, error_code &ec)#
int hpx::disconnect(double shutdown_timeout, error_code &ec)#