mirror of https://github.com/yandex/odyssey.git
machinarium: try PTHREAD_CANCEL_DISABLE/DEFERRED to avoid __libc calls
This commit is contained in:
parent
dd3e984431
commit
6b91e6e609
|
@ -37,6 +37,8 @@ machine_main(void *arg)
|
|||
mm_machine_t *machine = arg;
|
||||
mm_self = machine;
|
||||
|
||||
mm_thread_disable_cancel();
|
||||
|
||||
/* set thread name */
|
||||
if (machine->name)
|
||||
mm_thread_set_name(&machine->thread, machine->name);
|
||||
|
|
|
@ -43,3 +43,10 @@ int mm_thread_set_name(mm_thread_t *thread, char *name)
|
|||
rc = pthread_setname_np(thread->id, name);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int mm_thread_disable_cancel(void)
|
||||
{
|
||||
int unused;
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &unused);
|
||||
return pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &unused);
|
||||
}
|
||||
|
|
|
@ -21,5 +21,6 @@ struct mm_thread
|
|||
int mm_thread_create(mm_thread_t*, int, mm_thread_function_t, void*);
|
||||
int mm_thread_join(mm_thread_t*);
|
||||
int mm_thread_set_name(mm_thread_t*, char*);
|
||||
int mm_thread_disable_cancel(void);
|
||||
|
||||
#endif /* MM_THREAD_H */
|
||||
|
|
Loading…
Reference in New Issue