summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/scudo/standalone/tsd_shared.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/scudo/standalone/tsd_shared.h')
-rw-r--r--compiler-rt/lib/scudo/standalone/tsd_shared.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h
index 347295011bb..5ab8269519a 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -12,8 +12,6 @@
#include "linux.h" // for getAndroidTlsPtr()
#include "tsd.h"
-#include <pthread.h>
-
namespace scudo {
template <class Allocator, u32 MaxTSDCount> struct TSDRegistrySharedT {
@@ -73,13 +71,15 @@ template <class Allocator, u32 MaxTSDCount> struct TSDRegistrySharedT {
}
void disable() {
+ Mutex.lock();
for (u32 I = 0; I < NumberOfTSDs; I++)
TSDs[I].lock();
}
void enable() {
- for (u32 I = 0; I < NumberOfTSDs; I++)
+ for (s32 I = NumberOfTSDs - 1; I >= 0; I--)
TSDs[I].unlock();
+ Mutex.unlock();
}
private:
@@ -117,6 +117,7 @@ private:
// Initial context assignment is done in a plain round-robin fashion.
const u32 Index = atomic_fetch_add(&CurrentIndex, 1U, memory_order_relaxed);
setCurrentTSD(&TSDs[Index % NumberOfTSDs]);
+ Instance->callPostInitCallback();
}
NOINLINE TSD<Allocator> *getTSDAndLockSlow(TSD<Allocator> *CurrentTSD) {
OpenPOWER on IntegriCloud