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

Re: how to store static data in a multi-thread program?



>>>>> On Tue, 25 Dec 2001 03:55:04 +0300
>>>>> "Andrew" == Andrew Makhorin <mao@mai2.rcnet.ru> wrote:
Andrew> 
Andrew> I've got a multi-thread program (in C) running under Debian/GNU Linux.
Andrew> And I need to store a pointer somewhere in a system place related to an
Andrew> particular thread in order to pass it to other routines running in the
Andrew> same thread. In other words I need to pass a pointer within a thread as
Andrew> if it would be declared as extern (i.e. not as a formal parameter), but
Andrew> in a thread safe manner. Could anyone please tell me how to do that?

Think you need to use TSD, thread specific data. 
man pthread_key_create.

-- 
Alexander Kotelnikov
Saint-Petersburg, Russia



Reply to: