Defined in header hpx/runtime.hpp.

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

namespace hpx


std::uint32_t get_locality_id(error_code &ec = throws)#

Return the number of the locality this function is being called from.

This function returns the id of the current locality.


The returned value is zero based and its maximum value is smaller than the overall number of localities the current application is running on (as returned by get_num_localities()).


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.


This function needs to be executed on a HPX-thread. It will fail otherwise (it will return -1).


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.