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.
This commit is contained in:
David Chisnall
2019-11-18 13:33:22 +00:00
committed by David Chisnall
parent 31941eac06
commit 093b3cc650

View File

@@ -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.