Re: Glib::Threads:Private





On Wed, Feb 20, 2019 at 1:17 AM John Emmas <john creativepost co uk> wrote:
I realise it's a deprecated interface but can anyone explain what
Glib::Threads:Private<SomeObject> does?

Does it guarantee that 'SomeObject' can only be accessed by code running
in a particular thread?  And if so, does it do that by creating a
specific thread for the object - or does it use whichever thread was
running when Glib::Threads:Private got called?  Hope that makes sense....

It means that each thread that accesses the variable sees a distinct or "thread-local" version of it.
The language runtime creates memory for thread-local storage at program startup, and each thread has its own section (inaccessible from other threads) where these "thread-local" variables are allocated.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]