Background
Many of the UPC++ API calls (notably including all collective operations) require the calling thread to be holding the master persona. Also, the master persona is the only one that ever runs incoming RPCs and remote completions.
Problem
There is currently no way via the API to query the status of this critical master-ness property. We don't even provide a means to compare personas for equality. This creates a modularity problem with libraries layered atop UPC++, because they have no way to query the master status of a given thread, in order to control RPC progression or enforce their own invariants on the master-persona status of calls from their own clients.
Even in a monolithic threaded program with a "flat" threading design, it's annoying that one needs to manually track which thread is holding the master persona, when UPC++ already has to track this information and could easily expose it.
The following two complementary proposals are meant to help alleviate such difficulties.
Proposal 1:
bool upcxx::have_master_persona();
Semantics:
Returns true if and only if the master persona is in the active persona stack of the calling thread.
UPC++ progress level: none
Proposal 2:
Add EqualityComparable to upcxx::persona
operator==(const upcxx::persona& lhs, const upcxx::persona& rhs);
operator!=(const upcxx::persona& lhs, const upcxx::persona& rhs);
Semantics:
These operators return true if and only if the two provided personas are the same (or different, respectively) persona.
UPC++ progress level: none
I can clearly see the value to both proposals and the implementations cannot possibly be difficult.
