Thread: Re: Threads vs Processes

Re: Threads vs Processes

From
"Zeugswetter Andreas SB SD"
Date:
> "When the address-of operator is applied to a thread-local variable, it
> is evaluated at run-time and returns the address of the current thread's
> instance of that variable. An address so obtained may be used by any
> thread. When a thread terminates, any pointers to thread-local variables
> in that thread become invalid."

Bummer, I would have thought one advantage of using TLS must surely be memory
protection ? So the only for pg useful usage for TLS seems to be "__declspec(thread)"
and "__declspec(thread) static" (both for stuff that do not need runtime
preinitialization).

Maybe the techniques of electric fence could be used for protecting the shmem
at least a little bit.

Andreas