Threads and Static Data
"Jérôme M. Berger"
jeberger at free.fr
Thu Dec 13 11:27:07 PST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Regan Heath wrote:
> Jérôme M. Berger wrote:
>> - My first point was to illustrate what thread-local storage is for
>> as opposed to instance variables in the thread class. Another
>> illustration would be to point to this Wikipedia page:
>> http://en.wikipedia.org/wiki/Thread-local_storage
>
> I think the short explaination is that thread local storage is required
> when you want a separate copy of any _global_ variable for each thread.
> If you have no global varaibles, you don't need it.
>
Correct.
> ...
> On the other hand if the library encapsulates all it's variables in a
> class or struct[2] then you are free to have a separate instance of the
> class or struct per thread, typically as a member of your thread class.
>
This was my second point, yes.
Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
| mailto:jeberger at free.fr | ICQ: 238062172 |
| http://jeberger.free.fr/ | Jabber: jeberger at jabber.fr |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFHYYeLd0kWM4JG3k8RAjmZAJ9TrkrQWsY8pLFiiL7QaAlP4Jaw2wCfeMvm
bFU0D7dHNx6igQpKAy4gNxY=
=3KGC
-----END PGP SIGNATURE-----
More information about the Digitalmars-d
mailing list