add mac get context id
make thread_local a macro