[前][次][番号順一覧][スレッド一覧]

ruby-changes:50124

From: nobu <ko1@a...>
Date: Tue, 6 Feb 2018 10:42:44 +0900 (JST)
Subject: [ruby-changes:50124] nobu:r62242 (trunk): thread_pthread.c: cast inside rb_thread_create_mjit_thread

nobu	2018-02-06 10:42:38 +0900 (Tue, 06 Feb 2018)

  New Revision: 62242

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62242

  Log:
    thread_pthread.c: cast inside rb_thread_create_mjit_thread
    
    * thread_pthread.c (rb_thread_create_mjit_thread): cast
      worker_func pointer to void pointer inside.  adjusted to the
      declaration in mjit.c and the definition in thread_win32.c.

  Modified files:
    trunk/mjit.c
    trunk/thread_pthread.c
Index: mjit.c
===================================================================
--- mjit.c	(revision 62241)
+++ mjit.c	(revision 62242)
@@ -1198,7 +1198,7 @@ mjit_init(struct mjit_options *opts) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1198
     /* Initialize worker thread */
     finish_worker_p = FALSE;
     worker_finished = FALSE;
-    if (rb_thread_create_mjit_thread(child_after_fork, (void *)worker) == FALSE) {
+    if (!rb_thread_create_mjit_thread(child_after_fork, worker)) {
         mjit_init_p = FALSE;
         rb_native_mutex_destroy(&mjit_engine_mutex);
         rb_native_cond_destroy(&mjit_pch_wakeup);
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 62241)
+++ thread_pthread.c	(revision 62242)
@@ -1791,7 +1791,7 @@ mjit_worker(void *arg) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1791
 
 /* Launch MJIT thread. Returns FALSE if it fails to create thread. */
 int
-rb_thread_create_mjit_thread(void (*child_hook)(void), void *worker_func)
+rb_thread_create_mjit_thread(void (*child_hook)(void), void (*worker_func)(void))
 {
     pthread_attr_t attr;
     pthread_t worker_pid;
@@ -1799,7 +1799,7 @@ rb_thread_create_mjit_thread(void (*chil https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1799
     pthread_atfork(NULL, NULL, child_hook);
     if (pthread_attr_init(&attr) == 0
         && pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) == 0
-        && pthread_create(&worker_pid, &attr, mjit_worker, worker_func) == 0) {
+        && pthread_create(&worker_pid, &attr, mjit_worker, (void *)worker_func) == 0) {
         /* jit_worker thread is not to be joined */
         pthread_detach(worker_pid);
         return TRUE;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]