Subj : Re: speed-up critical regions To : comp.programming.threads From : amorox Date : Wed Jun 15 2005 02:05 pm Hi, Thanks for your answer. I'll try to explain more about my problem. I need the critical region to protect an alloc function. I have something very similar with what Glibc is using to implement the malloc function. You have arenas where your memory requests can be hosted, but you need to lock the arena before using a part of it. Once locked, you just need to make some cheap operations in the arena (since the memory space was allocated before in chunks) and return the demanded amount of memory. Glibc is always doing a low-level 'trylock' at the beginning of the malloc function. I need to do the same, but the speed of the 'pthread_mutex_trylock' I'm using is far behind the low-level asm trylock of glibc. So, I'm trying to find a way to minimize, at least, the trylock cost if the same thread is consecutively requesting memory. I tried to image different desing scenarios with no results so far. Regards, Ovidiu .