segfault using __thread variable