[m-users.] What is "thread-local storage"?
Julien Fischer
jfischer at opturion.com
Fri Dec 15 23:57:09 AEDT 2023
On Fri, 15 Dec 2023, Volker Wysk wrote:
> In mercury_memory.h, there's this:
>
> // MR_GC_NEW(type):
> // Allocates space for an object of the specified type.
> // If conservative GC is enabled, the object will be garbage collected
> // when it is no longer referenced from GC-traced memory.
> // Memory allocated with malloc() (or MR_malloc() or MR_NEW())
> // is not GC-traced. Nor is thread-local storage.
>
> I don't understand the "Nor is thread-local storage." part. What is
> "thread-local storage"?
In this context it can refer to values stored using the POSIX threads
function pthread_setspecific(), or to variables declared using GCC's
__thread keyword or C11's _Thread_local keyword.
> Do I need to care?
I can't answer that; I don't know what you are trying to do.
Julien.
More information about the users
mailing list