* src/threads/threads-common.c (threads_thread_create_internal):
authortwisti <none@none>
Thu, 26 Apr 2007 12:48:16 +0000 (12:48 +0000)
committertwisti <none@none>
Thu, 26 Apr 2007 12:48:16 +0000 (12:48 +0000)
Renamed to threads_thread_start_internal and start the thread.
(threads_start_javathread): Renamed to threads_thread_start.
* src/threads/threads-common.h: Likewise.

* src/threads/native/threads.c (threads_start_thread): Renamed to
threads_impl_thread_start.

* src/mm/memory.c (thread_memory): Removed.
(memory_start_thread): Call threads_thread_start_internal.

* src/vm/finalizer.c (thread_finalizer): Removed.
(finalizer_start_thread): Call threads_thread_start_internal.

* src/vm/signal.c (thread_signal): Removed.
(signal_start_thread): Call threads_thread_start_internal.

* src/vm/jit/optimizing/profile.c (thread_profile): Removed.
(profile_start_thread): Call threads_thread_start_internal.

* src/vm/jit/optimizing/recompile.c (thread_recompile): Removed.
(recompile_start_thread): Call threads_thread_start_internal.

src/mm/memory.c
src/threads/native/threads.c
src/threads/threads-common.c
src/threads/threads-common.h
src/vm/finalizer.c
src/vm/jit/optimizing/profile.c
src/vm/jit/optimizing/recompile.c
src/vm/signal.c

index 0f257dd3f19cd4da1983dda4423b75421bcb1ffb..bd864f8b7d98ba063a513125ecbd1f6aca6b9b0b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: memory.c 7813 2007-04-25 19:20:13Z twisti $
+   $Id: memory.c 7831 2007-04-26 12:48:16Z twisti $
 
 */
 
@@ -107,13 +107,6 @@ static int                code_memory_size = 0;
 static int                pagesize         = 0;
 
 
-/* global variables ***********************************************************/
-
-#if defined(ENABLE_THREADS)
-static threadobject *thread_memory;
-#endif
-
-
 /* memory_init *****************************************************************
 
    Initialize the memory subsystem.
@@ -411,15 +404,11 @@ bool memory_start_thread(void)
 
        name = utf_new_char("Memory Profiler");
 
-       thread_memory = threads_thread_create_internal(name);
+       /* start the memory profiling thread */
 
-       if (thread_memory == NULL)
+       if (!threads_thread_start_internal(name, memory_thread))
                return false;
 
-       /* actually start the memory profiling thread */
-
-       threads_start_thread(thread_memory, memory_thread);
-
        /* everything's ok */
 
        return true;
index d696264e7ed5745f73de94ad630cc2da5d1ec3ea..a7883c2cb62247aadc59f3b64f4bb3e90854acfe 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads.c 7830 2007-04-26 11:14:39Z twisti $
+   $Id: threads.c 7831 2007-04-26 12:48:16Z twisti $
 
 */
 
@@ -1013,18 +1013,19 @@ static void *threads_startup_thread(void *t)
 }
 
 
-/* threads_start_thread ********************************************************
+/* threads_impl_thread_start ***************************************************
 
-   Start a thread in the JVM. Both (vm internal and java) thread objects exist.
+   Start a thread in the JVM.  Both (vm internal and java) thread
+   objects exist.
 
    IN:
-      thread.......the thread object
-         function.....function to run in the new thread. NULL means that the
-                      "run" method of the object `t` should be called
+      thread....the thread object
+         f.........function to run in the new thread. NULL means that the
+                   "run" method of the object `t` should be called
 
 ******************************************************************************/
 
-void threads_start_thread(threadobject *thread, functionptr function)
+void threads_impl_thread_start(threadobject *thread, functionptr f)
 {
        sem_t          sem;
        sem_t          sem_first;
@@ -1035,7 +1036,7 @@ void threads_start_thread(threadobject *thread, functionptr function)
         * threads_startup_thread */
 
        startup.thread     = thread;
-       startup.function   = function;       /* maybe we don't call Thread.run()V */
+       startup.function   = f;              /* maybe we don't call Thread.run()V */
        startup.psem       = &sem;
        startup.psem_first = &sem_first;
 
index 48b584e9db420167cddee3cd05f15c49117fbfee..d1dfefa4f152d7d8fcc3f60bb9a497a34698fcaf 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads-common.c 7830 2007-04-26 11:14:39Z twisti $
+   $Id: threads-common.c 7831 2007-04-26 12:48:16Z twisti $
 
 */
 
@@ -306,15 +306,18 @@ threadobject *threads_create_thread(void)
 }
 
 
-/* threads_thread_create_internal **********************************************
+/* threads_thread_start_internal ***********************************************
 
-   Creates an internal thread data-structure with the given name, plus
-   necessary Java objects for the VM (e.g. finalizer-thread,
-   signal-thread, ...).
+   Start an internal thread in the JVM.  No Java thread objects exists
+   so far.
+
+   IN:
+      name.......UTF-8 name of the thread
+      f..........function pointer to C function to start
 
 *******************************************************************************/
 
-threadobject *threads_thread_create_internal(utf *name)
+bool threads_thread_start_internal(utf *name, functionptr f)
 {
        threadobject       *thread;
        java_lang_Thread   *t;
@@ -331,13 +334,13 @@ threadobject *threads_thread_create_internal(utf *name)
        t = (java_lang_Thread *) builtin_new(class_java_lang_Thread);
 
        if (t == NULL)
-               return NULL;
+               return false;
 
 #if defined(WITH_CLASSPATH_GNU)
        vmt = (java_lang_VMThread *) builtin_new(class_java_lang_VMThread);
 
        if (vmt == NULL)
-               return NULL;
+               return false;
 
        vmt->thread = t;
        vmt->vmdata = (java_lang_Object *) thread;
@@ -358,22 +361,27 @@ threadobject *threads_thread_create_internal(utf *name)
 #endif
        t->priority = NORM_PRIORITY;
 
-       /* return the thread data-structure */
+       /* start the thread */
 
-       return thread;
+       threads_impl_thread_start(thread, f);
+
+       /* everything's ok */
+
+       return true;
 }
 
 
-/* threads_start_javathread ****************************************************
+/* threads_thread_start ********************************************************
 
-   Start a thread in the JVM. Only the java thread object exists so far.
+   Start a Java thread in the JVM.  Only the java thread object exists
+   so far.
 
    IN:
       object.....the java thread object java.lang.Thread
 
 *******************************************************************************/
 
-void threads_start_javathread(java_lang_Thread *object)
+void threads_thread_start(java_lang_Thread *object)
 {
        threadobject *thread;
 
@@ -401,10 +409,10 @@ void threads_start_javathread(java_lang_Thread *object)
        object->vm_thread = (java_lang_Object *) thread;
 #endif
 
-       /* Actually start the thread.  Don't pass a function pointer
-          (NULL) since we want Thread.run()V here. */
+       /* Start the thread.  Don't pass a function pointer (NULL) since
+          we want Thread.run()V here. */
 
-       threads_start_thread(thread, NULL);
+       threads_impl_thread_start(thread, NULL);
 }
 
 
index dcd0fd79add7c14488e7c7ee98e3d256d64ab9bb..e6a8dd35043baa9725dca801cd539bdf94bf5628 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads-common.h 7830 2007-04-26 11:14:39Z twisti $
+   $Id: threads-common.h 7831 2007-04-26 12:48:16Z twisti $
 
 */
 
@@ -107,8 +107,8 @@ s4            threads_table_add(threadobject *thread);
 void          threads_table_remove(threadobject *thread);
 
 threadobject *threads_create_thread(void);
-threadobject *threads_thread_create_internal(utf *name);
-void          threads_start_javathread(java_lang_Thread *object);
+bool          threads_thread_start_internal(utf *name, functionptr f);
+void          threads_thread_start(java_lang_Thread *object);
 
 ptrint        threads_get_current_tid(void);
 utf          *threads_thread_get_state(threadobject *thread);
@@ -124,6 +124,7 @@ void          threads_print_stacktrace(void);
 void          threads_impl_preinit(void);
 
 void          threads_init_threadobject(threadobject *thread);
+void          threads_impl_thread_start(threadobject *thread, functionptr f);
 
 #endif /* ENABLE_THREADS */
 
index 56aa43c7e67143137d79041b8113b52fe5003d6f..4c77e4af29107bb8bcb201ea3fc19c95ff9ab2fd 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: finalizer.c 7813 2007-04-25 19:20:13Z twisti $
+   $Id: finalizer.c 7831 2007-04-26 12:48:16Z twisti $
 
 */
 
@@ -52,7 +52,6 @@
 /* global variables ***********************************************************/
 
 #if defined(ENABLE_THREADS)
-static threadobject      *thread_finalizer;
 static java_objectheader *lock_thread_finalizer;
 #endif
 
@@ -122,15 +121,9 @@ bool finalizer_start_thread(void)
 
        name = utf_new_char("Finalizer");
 
-       thread_finalizer = threads_thread_create_internal(name);
-
-       if (thread_finalizer == NULL)
+       if (!threads_thread_start_internal(name, finalizer_thread))
                return false;
 
-       /* actually start the finalizer thread */
-
-       threads_start_thread(thread_finalizer, finalizer_thread);
-
        /* everything's ok */
 
        return true;
index cf3a99c6906e9251bbe2f3226acf24422de9e1c5..09d18803687d0b2f74c28c979a4ac87fe0a0df2d 100644 (file)
 #include "vmcore/options.h"
 
 
-/* global variables ***********************************************************/
-
-#if defined(ENABLE_THREADS)
-static threadobject *thread_profile;
-#endif
-
-
 /* profile_init ****************************************************************
 
    Initializes the profile global lock.
@@ -181,15 +174,9 @@ bool profile_start_thread(void)
 
        name = utf_new_char("Profiling Sampler");
 
-       thread_profile = threads_thread_create_internal(name);
-
-       if (thread_profile == NULL)
+       if (!threads_thread_start_internal(name, profile_thread))
                return false;
 
-       /* actually start the profile sampling thread */
-
-       threads_start_thread(thread_profile, profile_thread);
-
        /* everything's ok */
 
        return true;
index fc04c7337b759e7d05f38328462abdb3f9db6642..bca3ef36cf733474b14c786702962ae98763bda2 100644 (file)
@@ -55,7 +55,6 @@
 
 /* global variables ***********************************************************/
 
-static threadobject      *thread_recompile;
 static java_objectheader *lock_thread_recompile;
 static list_t            *list_recompile_methods;
 
@@ -217,15 +216,9 @@ bool recompile_start_thread(void)
 
        name = utf_new_char("Recompiler");
 
-       thread_recompile = threads_thread_create_internal(name);
-
-       if (thread_recompile == NULL)
+       if (!threads_thread_start_internal(name, recompile_thread))
                return false;
 
-       /* actually start the recompilation thread */
-
-       threads_start_thread(thread_recompile, recompile_thread);
-
        /* everything's ok */
 
        return true;
index 456fbdf25a14efa1707b6a06d9300b5a35278a83..f1f1b462b970606fc4ecfecbfb54ea29c6f4a9db 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: signal.c 7811 2007-04-25 18:33:30Z twisti $
+   $Id: signal.c 7831 2007-04-26 12:48:16Z twisti $
 
 */
 
 #endif
 
 
-/* global variables ***********************************************************/
-
-#if defined(ENABLE_THREADS)
-static threadobject *thread_signal;
-#endif
-
-
 /* function prototypes ********************************************************/
 
 void signal_handler_sighup(int sig, siginfo_t *siginfo, void *_p);
@@ -273,15 +266,9 @@ bool signal_start_thread(void)
 
        name = utf_new_char("Signal Handler");
 
-       thread_signal = threads_thread_create_internal(name);
-
-       if (thread_signal == NULL)
+       if (!threads_thread_start_internal(name, signal_thread))
                return false;
 
-       /* actually start the signal handler thread */
-
-       threads_start_thread(thread_signal, signal_thread);
-
        /* everything's ok */
 
        return true;