зеркало из https://github.com/github/ruby.git
Remove unused rb_thread_create_mjit_thread
follow up https://github.com/ruby/ruby/pull/6006
This commit is contained in:
Родитель
23459e4dbb
Коммит
a327ce8b07
2
mjit.c
2
mjit.c
|
@ -29,8 +29,6 @@
|
||||||
|
|
||||||
#include "mjit_worker.c"
|
#include "mjit_worker.c"
|
||||||
|
|
||||||
extern int rb_thread_create_mjit_thread(void (*worker_func)(void));
|
|
||||||
|
|
||||||
// Return an unique file name in /tmp with PREFIX and SUFFIX and
|
// Return an unique file name in /tmp with PREFIX and SUFFIX and
|
||||||
// number ID. Use getpid if ID == 0. The return file name exists
|
// number ID. Use getpid if ID == 0. The return file name exists
|
||||||
// until the next function call.
|
// until the next function call.
|
||||||
|
|
|
@ -2156,40 +2156,6 @@ rb_nativethread_self(void)
|
||||||
return pthread_self();
|
return pthread_self();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_MJIT
|
|
||||||
/* A function that wraps actual worker function, for pthread abstraction. */
|
|
||||||
static void *
|
|
||||||
mjit_worker(void *arg)
|
|
||||||
{
|
|
||||||
void (*worker_func)(void) = (void(*)(void))arg;
|
|
||||||
|
|
||||||
#ifdef SET_CURRENT_THREAD_NAME
|
|
||||||
SET_CURRENT_THREAD_NAME("ruby-mjitworker"); /* 16 byte including NUL */
|
|
||||||
#endif
|
|
||||||
worker_func();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Launch MJIT thread. Returns FALSE if it fails to create thread. */
|
|
||||||
int
|
|
||||||
rb_thread_create_mjit_thread(void (*worker_func)(void))
|
|
||||||
{
|
|
||||||
pthread_attr_t attr;
|
|
||||||
pthread_t worker_pid;
|
|
||||||
int ret = FALSE;
|
|
||||||
|
|
||||||
if (pthread_attr_init(&attr) != 0) return ret;
|
|
||||||
|
|
||||||
/* jit_worker thread is not to be joined */
|
|
||||||
if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0
|
|
||||||
&& pthread_create(&worker_pid, &attr, mjit_worker, (void *)worker_func) == 0) {
|
|
||||||
ret = TRUE;
|
|
||||||
}
|
|
||||||
pthread_attr_destroy(&attr);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_sigwait_fd_get(const rb_thread_t *th)
|
rb_sigwait_fd_get(const rb_thread_t *th)
|
||||||
{
|
{
|
||||||
|
|
|
@ -879,29 +879,4 @@ native_thread_native_thread_id(rb_thread_t *th)
|
||||||
}
|
}
|
||||||
#define USE_NATIVE_THREAD_NATIVE_THREAD_ID 1
|
#define USE_NATIVE_THREAD_NATIVE_THREAD_ID 1
|
||||||
|
|
||||||
#if USE_MJIT
|
|
||||||
static unsigned long __stdcall
|
|
||||||
mjit_worker(void *arg)
|
|
||||||
{
|
|
||||||
void (*worker_func)(void) = arg;
|
|
||||||
rb_w32_set_thread_description(GetCurrentThread(), L"ruby-mjitworker");
|
|
||||||
worker_func();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Launch MJIT thread. Returns FALSE if it fails to create thread. */
|
|
||||||
int
|
|
||||||
rb_thread_create_mjit_thread(void (*worker_func)(void))
|
|
||||||
{
|
|
||||||
size_t stack_size = 4 * 1024; /* 4KB is the minimum commit size */
|
|
||||||
HANDLE thread_id = w32_create_thread(stack_size, mjit_worker, worker_func);
|
|
||||||
if (thread_id == 0) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
w32_resume_thread(thread_id);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */
|
#endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче