cburstedde / libsc

The "sc" auxiliary library
www.p4est.org/
GNU Lesser General Public License v2.1
36 stars 34 forks source link

Add package id query function. #133

Closed jmark closed 1 year ago

jmark commented 1 year ago

In some scenarios it is useful to have a dedicated query function for SC's own package id. For example, not all wrapper generators or FFIs (foreign function interfaces) support to read global external variables.

cburstedde commented 1 year ago

Thanks! I'm wondering, should sc_finalize reset is_initialized to 0. This will also set the package id back to -1.

The user should be told very clearly that these functions are not thread-safe and refer to global variables.

jmark commented 1 year ago

Good point! I adapted the code accordingly. Also added a note about not being thread-safe.

I can actually think of use cases where SC is initialzed and finalized multiple times during the runtime of an application. Querying the current status of SC would be very helpful in such cases.

cburstedde commented 1 year ago

Thanks! Just added some doc tweaks.