1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

thread_pthread.c: add a macro guard for PTHREAD_CANCEL_ENABLE

It seems to be unavailable on some platforms including my Android phone.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-08-03 05:11:20 +00:00
parent 8c2ae6e3ed
commit 4cef2c8d6b

View file

@ -1551,9 +1551,11 @@ mjit_worker(void *arg)
{ {
void (*worker_func)(void) = (void(*)(void))arg; void (*worker_func)(void) = (void(*)(void))arg;
#ifdef PTHREAD_CANCEL_ENABLE
if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0) { if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0) {
fprintf(stderr, "Cannot enable cancellation in MJIT worker\n"); fprintf(stderr, "Cannot enable cancellation in MJIT worker\n");
} }
#endif
#ifdef SET_CURRENT_THREAD_NAME #ifdef SET_CURRENT_THREAD_NAME
SET_CURRENT_THREAD_NAME("ruby-mjitworker"); /* 16 byte including NUL */ SET_CURRENT_THREAD_NAME("ruby-mjitworker"); /* 16 byte including NUL */
#endif #endif