Boehm's signal handlers.
* src/threads/native/threads.c (threads_preinit): Removed dummy
allocation.
* src/vm/vm.c (vm_create): Call threads_preinit before gc_init.
* src/cacaoh/cacaoh.c (main): Likewise.
Philipp Tomsich
Christian Thalinger
- $Id: cacaoh.c 5577 2006-09-29 10:38:58Z twisti $
+ $Id: cacaoh.c 5809 2006-10-20 13:09:54Z twisti $
*/
log_text("Java - header-generator started");
}
- /* initialize the garbage collector */
-
- gc_init(heapmaxsize, heapstartsize);
-
#if defined(ENABLE_THREADS)
+ /* pre-initialize some core thread stuff, like the stopworldlock,
+ thus this has to happen _before_ gc_init()!!! */
+
threads_preinit();
#endif
+ /* initialize the garbage collector */
+
+ gc_init(heapmaxsize, heapstartsize);
+
/* initialize the string hashtable stuff: lock (must be done
_after_ threads_preinit) */
Changes: Christian Thalinger
Edwin Steiner
- $Id: threads.c 5806 2006-10-19 10:10:23Z twisti $
+ $Id: threads.c 5809 2006-10-20 13:09:54Z twisti $
*/
Do some early initialization of stuff required.
+ ATTENTION: Do NOT use any Java heap allocation here, as gc_init()
+ is called AFTER this function!
+
*******************************************************************************/
void threads_preinit(void)
pthread_mutex_init(&threadlistlock, NULL);
pthread_mutex_init(&stopworldlock, NULL);
- /* Allocate something so the garbage collector's signal handlers
- are installed. */
- heap_allocate(1, false, NULL);
-
mainthreadobj = NEW(threadobject);
- mainthreadobj->tid = pthread_self();
- mainthreadobj->index = 1;
+ mainthreadobj->tid = pthread_self();
+ mainthreadobj->index = 1;
mainthreadobj->thinlock = lock_pre_compute_thinlock(mainthreadobj->index);
#if !defined(HAVE___THREAD)
Changes:
- $Id: signal.c 5806 2006-10-19 10:10:23Z twisti $
+ $Id: signal.c 5809 2006-10-20 13:09:54Z twisti $
*/
#if !defined(__CYGWIN__)
struct sigaction act;
+ /* Allocate something so the garbage collector's signal handlers
+ are installed. */
+
+ (void) GCNEW(u1);
+
/* install signal handlers we need to convert to exceptions */
sigemptyset(&act.sa_mask);
vm_initializing = true;
+#if defined(ENABLE_THREADS)
+ /* pre-initialize some core thread stuff, like the stopworldlock,
+ thus this has to happen _before_ gc_init()!!! */
+
+ threads_preinit();
+#endif
+
/* initialize the garbage collector */
gc_init(opt_heapmaxsize, opt_heapstartsize);
}
#endif
-#if defined(ENABLE_THREADS)
- threads_preinit();
-#endif
-
/* initialize the string hashtable stuff: lock (must be done
_after_ threads_preinit) */