It may be more important to have thread-local pools for memory allocation. Well, it's hard to guess without some measurements on which data and resources the threads are actively competing for.
/ Niels Möller (vässar rödpennan)
Previous text:
2004-02-03 07:22: Subject: Re: Default backend and thread backends?
It's a good plan, and I think it has a good chance of working. I would combine it with an addition go gc() that returns the thread-local flag on things which are no longer global automatically.
However, I'm still not entirely sure that this will be fast enough to be worth it. There will still be a lot of locking operations, and there will be a *lot* of places where the local/global flag would have to be checked.
In fact, I'm not entirely sure that it's mutch faster than having one mutex per object, because locking an unlocked mutex takes very little time. (Similar to checking a flag.)
/ Fredrik (Naranek) Hubinette (Real Build Master)