dist_object destructor should be permitted after finalize

Issue #161 resolved
Dan Bonachea created an issue

Currently the spec for ~dist_object() requires "Calling thread must have the master persona." and does not grant any exceptions for invocation after library finalization.

However, there are many places in our current tests (and probably user code as well) where we assume a dist_object<T> allocated on the stack in main() can be destroyed by return-from-main after upcxx::finalize(), but by the current spec this is prohibited.

team and atomic_domain destructors have explicit exceptions to allow simple destruction post-finalize. Unlike team and atomic_domain, dist_object does not have a destroy(), but it's still a collective object and I believe the same logic applies here. If anything the lack of a destroy() call makes it more annoying to satisfy the over-constrained requirements.

I think the solution is the spec for ~dist_object() should be loosened in ways analogous to the destructors for team and atomic_domain - namely, exclude the master persona precondition if the library was uninitialized since object construction, and apply the standard exception text to allow invocation outside finalize.

Comments (4)

  1. Log in to comment