Re: Threads vs Processes

Поиск
Список
Период
Сортировка
От Claudio Natoli
Тема Re: Threads vs Processes
Дата
Msg-id A02DEC4D1073D611BAE8525405FCCE2B027F61@harris.memetrics.local
обсуждение исходный текст
Список pgsql-hackers
 
> Another option would be to create thread local hashtable or other lookup
> structure to which you would register a structure for a particular .c 
> file or group of files.
> 
> You could then define the structures you need locally without 
> affecting other parts of the codebase.
> 
> 
> 
> Myron Scott

A slight variant on this idea would be to mask the variables themselves,
using macrology on a hash keyed on the threadID.

To illustrate:MyProc->errType

would, on a threaded system, become something like:((PGProc*)ThreadLocalHash(MyProc,GetCurrentThreadID()))->errType

I'm imagining that an approach like this would fit in very nicely with the
existing code. Not the most performance friendly solution however (and I'm
guessing that there might be a place or two where this might be important
:-).

Just a thought,
Claudio

--- 
WE HAVE MOVED - PLEASE NOTE OUR NEW CONTACT DETAILS: 
THE BASEMENT, 33 EWELL STREET, BALMAIN NSW 2041 
TEL: +61 2 9555 1544 FAX: +61 2 9555 6911 
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see 
http://www.memetrics.com/emailpolicy.html


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Error message cleanup
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: feature request: show pgsql version when running initdb