[K/N][New MM] Disallow getting thread data for detached threads
This patch fixes a performance degradation introduced by
99bd26c2ef (Switch thread states
in termination handlers).
This commit is contained in:
@@ -389,11 +389,17 @@ namespace kotlin {
|
||||
namespace mm {
|
||||
|
||||
// Returns the MemoryState for the current thread.
|
||||
// If the memory subsystem isn't initialized for the current thread, returns nullptr.
|
||||
// The current thread must be attached to the runtime.
|
||||
// Try not to use it very often, as (1) thread local access can be slow on some platforms,
|
||||
// (2) TLS gets deallocated before our thread destruction hooks run.
|
||||
MemoryState* GetMemoryState() noexcept;
|
||||
|
||||
|
||||
// TODO: Replace with direct access to ThreadRegistry when the legacy MM is gone.
|
||||
// Checks if the current thread is attached to the runtime.
|
||||
// This function accesses a TLS variable, so it must not be called from a thread destructor.
|
||||
bool IsCurrentThreadRegistered() noexcept;
|
||||
|
||||
} // namespace mm
|
||||
|
||||
enum class ThreadState {
|
||||
|
||||
Reference in New Issue
Block a user