From 093b3cc6507e986cbbe9398a98b4204e9e3628d9 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Mon, 18 Nov 2019 13:33:22 +0000 Subject: [PATCH] Make the get_reference() method on ThreadAlloc public. This is required so that we can replace the thread allocator during setup for the library compartmentalisation case. --- src/mem/threadalloc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mem/threadalloc.h b/src/mem/threadalloc.h index 67e011c..4698aa0 100644 --- a/src/mem/threadalloc.h +++ b/src/mem/threadalloc.h @@ -92,13 +92,17 @@ namespace snmalloc } #endif + public: + /** + * Returns a reference to the allocator for the current thread. This allows + * the caller to replace the current thread's allocator. + */ static inline Alloc*& get_reference() { static thread_local Alloc* alloc = &GlobalPlaceHolder; return alloc; } - public: /** * Public interface, returns the allocator for this thread, constructing * one if necessary.