[Haskell] reader-like IO, parents of threads

John Meacham john at repetae.net
Tue Oct 18 18:46:56 EDT 2005


On Tue, Oct 18, 2005 at 07:12:13PM +0100, Frederik Eaton wrote:
> (Pthreads also has support for "thread-specific data":
> 
>     -- Function: int pthread_setspecific (pthread_key_t KEY, const void
>              *POINTER)
>         `pthread_setspecific' changes the value associated with KEY in the
>         calling thread, storing the given POINTER instead.
> 
>         If there is no such key KEY, it returns `EINVAL'.  Otherwise it
>         returns 0.
> 
>     -- Function: void * pthread_getspecific (pthread_key_t KEY)
>         `pthread_getspecific' returns the value currently associated with
>         KEY in the calling thread.
> 
>         If there is no such key KEY, it returns `NULL'.

in gcc you can create (faster) thread local storage with the __thread
keyword. as in

__thread int foo;

means that foo will be local to each thread.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Haskell mailing list