On Fri, May 24, 2013 at 1:41 AM, James Peach <jpe...@apache.org> wrote:

> Hi Yunkai,
>
> I'm looking at the reclaimable freelist code, and this jumped out at me:
>
>         static inline pthread_t thread_id(void)
>         {
>           static __thread pthread_t tid;
>
>           return tid?tid:(tid = pthread_self());
>         }
>
> Why does this need to cache the thread ID in thread local storage?
>

Getting thread id is a very frequent operation in reclaimabe-freelist, but
pthread_selft() isn't a inline function, I wanted to cache it so that we
can reduce one function calling.



>
> J
>



-- 
Yunkai Zhang
Work at Taobao

Reply via email to