...
Code Block | ||||
---|---|---|---|---|
| ||||
void func(void *data) { /* ... */ if (thread_should_exit) { thrd_exit(0); // OK } /* ... */ } int main(void) { int result; thrd_t thread; int result; if ((result = thrd_create(&tid, func, NULL)) != thrd_success) { /* Handle Error */ } return 0; } |
Exceptions
CON37:EX0: Platforms that provide defined behavior when multithreaded programs use custom signal handlers are exempt from this rule. This would include POSIX.
Risk Assessment
Mixing signals and threads causes undefined behavior.
...