Enh: Provide `upcxx::in_progress()` query

Issue #170 resolved
Dan Bonachea created an issue

Overview

UPC++ has a "restricted context" (specified in 10.2) that imposes behavioral restrictions on user code running in callbacks triggered inside user-level progress. However there is currently no API to directly query whether a given piece of code is running in the restricted context (and hence subject to the restrictions), and in modular codes this information may have been erased in higher levels of abstraction. In Impl issue 416 we have a stakeholder request to provide such a query, and I agree.

Proposal

Add to section 10.5 (immediately after upcxx::progress():

bool in_progress();

Returns true if and only if the calling thread is currently executing in the restricted context (sec 10.2), in other words, within the dynamic scope of user-level progress.

UPC++ progress level: none

Discussion

The implementation is trivial. The runtime is already obliged to track this information on a per-thread basis, and it should be zero-impact/zero-risk to expose this query to the client.

Comments (2)

  1. Log in to comment