Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Thread Local Storage
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-02-14 (02:40)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] Re: Thread Local Storage
> I don't know if there are better solutions but at least you can use an
> hashtable or a balanced tree or whatever (protected by a mutex) indexed on
> thread identifiers as reported by  " (Thread.self ())" or
> something similar.

Yes, but that means that you need functions to lookup the values,
rather than having the value have process-dependent values globally.
Think like Sys.argv (etc) -- this'd require changes to the interfaces
(not such a big deal, since I have control over all interfaces).

But to go even further, having distinct descriptors for
stdin/stdout/stderr, then you could see where this would become
unstuck. Whilst I have code that can change the value transparently
for stdin/stdout/stderr, this'd make for a bigger process switch if I
had to do for all TLS values.

Perhaps what I need would require a change to the compiler and runtime
=/ What I'd also want to avoid, but I guess I'll have to face the