New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applier::get_locality_id() should return an error value (or throw an exception) #320

Closed
brycelelbach opened this Issue Jul 10, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@brycelelbach
Member

brycelelbach commented Jul 10, 2012

[reported by hkaiser] [Trac time Mon Feb 20 21:33:47 2012] Rev. 292dd02 introduced:

===================================================================
> --- trunk/hpx/src/runtime/applier/applier.cpp 2012-02-20 03:02:20 UTC
> (rev 7062)
> +++ trunk/hpx/src/runtime/applier/applier.cpp 2012-02-20 06:29:29 UTC
> (rev 7063)
> @@ -402,7 +402,8 @@
>  {
>      HPX_API_EXPORT boost::uint32_t get_locality_id()
>      {
> -        return applier::get_applier().get_locality_id();
> +        applier::applier** appl = applier::applier::applier_.get();
> +        return appl ? (*appl)->get_locality_id() : 0;
>      }
>  }

This is not good as the returned zero refers to the AGAS locality, which is probably not the desired behavior for all use cases (even if it might be the correct behavior during the bootstrap process).

The better solution would be to introduce a sentinel value for an invalid_locality_id (i.e. ~0) and check for that value during bootstrap.

@brycelelbach

This comment has been minimized.

Show comment
Hide comment
@brycelelbach

brycelelbach Jul 10, 2012

Member

[comment by hkaiser] [Trac time Wed Feb 22 01:32:45 2012] That has been fixed, the function now returns naming::invalid_locality_id (which is equal to ~0U)

Member

brycelelbach commented Jul 10, 2012

[comment by hkaiser] [Trac time Wed Feb 22 01:32:45 2012] That has been fixed, the function now returns naming::invalid_locality_id (which is equal to ~0U)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment