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.
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 $
*/
static int pagesize = 0;
-/* global variables ***********************************************************/
-
-#if defined(ENABLE_THREADS)
-static threadobject *thread_memory;
-#endif
-
-
/* memory_init *****************************************************************
Initialize the memory subsystem.
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;
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 $
*/
}
-/* 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;
* 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;
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 $
*/
}
-/* 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;
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;
#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;
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);
}
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 $
*/
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);
void threads_impl_preinit(void);
void threads_init_threadobject(threadobject *thread);
+void threads_impl_thread_start(threadobject *thread, functionptr f);
#endif /* ENABLE_THREADS */
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 $
*/
/* global variables ***********************************************************/
#if defined(ENABLE_THREADS)
-static threadobject *thread_finalizer;
static java_objectheader *lock_thread_finalizer;
#endif
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;
#include "vmcore/options.h"
-/* global variables ***********************************************************/
-
-#if defined(ENABLE_THREADS)
-static threadobject *thread_profile;
-#endif
-
-
/* profile_init ****************************************************************
Initializes the profile global lock.
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;
/* global variables ***********************************************************/
-static threadobject *thread_recompile;
static java_objectheader *lock_thread_recompile;
static list_t *list_recompile_methods;
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;
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);
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;