static struct local_error *error_context() { struct local_error *context = (struct local_error *)local_storage_get(&local_error_key); if (!context) { context = malloc(sizeof(struct local_error)); assert(context); context->is_error = false; local_storage_set(&local_error_key, context); } return context; }
void thread_setid(int id) { local_storage_set(&thread_id_key, (void*)(ptrdiff_t)id); }