Change-Id: I4c546d8e3479b7498c9ed2def85b7f710672b071
return 0;
}
-__attribute__((noreturn)) static void thread_seppuku(struct reader_common *reader)
+__attribute__((noreturn)) static void thread_seppuku(pthread_t self)
{
- const pthread_t self = reader->thread;
assert(self == pthread_self());
-
- reader->thread = 0; // make sure the destructor won't join the thread
- reader_free(reader);
-
pthread_detach(self); // since there's nobody to join us
pthread_cancel(self);
pthread_testcancel(); // force the cancel in case it didn't happen immediately
return;
#endif
- thread_seppuku(reader); // prevent a leak
+ const pthread_t self = reader->thread;
+ reader->thread = 0;
+ reader_free(reader);
+
+ thread_seppuku(self); // prevent a leak
__builtin_unreachable();
}