16 static pthread_key_t align_key
;
17 static pthread_once_t align_key_once
= PTHREAD_ONCE_INIT
;
21 align_destroy(void *align
)
30 pthread_key_create(&align_key
, align_destroy
);
39 memset(tabs
, 9, 1024);
41 if (!(new_align
= malloc(sizeof(int))))
45 pthread_once(&align_key_once
, align_key_create
);
47 pthread_setspecific(align_key
, new_align
);
56 static int main_align
= 1;
59 debug_init_nothreads()
61 memset(tabs
, 9, 1024);
68 fn_begin(char *format
, ...)
76 align
= pthread_getspecific(align_key
);
81 va_start(args
, format
);
82 vsprintf(msg_buf
, format
, args
);
85 strcat(msg_buf
, " {\n");
87 sprintf(final_msg
, "%d: %.*s%s", getpid(), *align
, tabs
, msg_buf
);
88 fprintf(stderr
, "%s", final_msg
);
99 align
= pthread_getspecific(align_key
);
106 fprintf(stderr
, "%d: %.*s}\n", getpid(), *align
, tabs
);
116 _D(fn_begin("fn2(i = %d)", i));
131 _D(fn_begin("main"));