PETSC_TLS#
Marks a variable as thread-local when PETSc is configured with thread safety
Synopsis#
#include <petscmacros.h>
PETSC_TLS type variable;
Notes#
When configured with --with-threadsafety=1, each thread has its own instance of the variable, whose lifetime is the lifetime of that thread.
With --with-threadsafety=0, PETSC_TLS expands to nothing.
In C, this macro uses C11 _Thread_local. In C++, it uses C++11 thread_local, except with Clang, where it uses _Thread_local
to allow C++ code to access thread-local variables defined in C without requiring C++ initialization wrappers.
Use PETSC_EXTERN PETSC_TLS for an exported declaration or PETSC_INTERN PETSC_TLS for an internal declaration.
Example Usage#
See Also#
Level#
developer
Location#
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages