Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions source/timemory/process/threading.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,17 @@ struct affinity
//
//--------------------------------------------------------------------------------------//
//
inline thread_local bool is_shutting_down = false;

inline void set_is_shutting_down(bool shutting_down = true)
{
is_shutting_down = shutting_down;
}

inline bool get_is_shutting_down()
{
return is_shutting_down;
}
} // namespace threading
} // namespace tim

Expand Down
4 changes: 2 additions & 2 deletions source/timemory/sampling/sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ template <template <typename...> class CompT, size_t N, typename... Types>
void
sampler<CompT<Types...>, N>::execute(int signum)
{
if(!trait::runtime_enabled<this_type>::get())
if(!trait::runtime_enabled<this_type>::get() || threading::get_is_shutting_down())
return;

// save errno
Expand Down Expand Up @@ -411,7 +411,7 @@ template <template <typename...> class CompT, size_t N, typename... Types>
void
sampler<CompT<Types...>, N>::execute(int signum, siginfo_t* _info, void* _data)
{
if(!trait::runtime_enabled<this_type>::get())
if(!trait::runtime_enabled<this_type>::get() || threading::get_is_shutting_down())
return;

// save errno
Expand Down