For boehm-gc:

* configure.in: Rename THREADLIB to THREADLIBS.
	* Makefile.am (LINK): Add $(THREADLIBS) to libtool command line. This
	ensures that we link the correct version of the linuxthreads semaphore
	functions.
	* Makefile.in: Rebuilt.
	* configure: Rebuilt.

	* linux_thread.c (GC_thr_init, GC_suspend_handler): Add SIGABRT to the
	list of signals which are not blocked during suspend in the NO_SIGNALS
	case.

For libjava:
	* Makefile.am (libgcj_la_LIBADD): Add $(THREADLIBS). This ensures that
	the correct versions of various linuxthreads functions get linked.
	* Makefile.in: Rebuilt.
	* java/lang/natThread.cc (finalize_native): New static function. Call
	_Jv_ThreadDestroyData.
	(initialize_native): Register finalizer for "data".
	* include/posix-threads.h (_Jv_ThreadInitData): New simpler prototype.
	(_Jv_ThreadDestroyData): New prototype.
	* include/win32-threads.h: Ditto.
	* include/no-threads.h: Ditto.
	* posix-threads.cc (_Jv_ThreadInitData): Implement new prototype.
	(_Jv_ThreadDestroyData): New function. Free native thread "data" and
	move mutex and condition variable destroy code from:
	(really_start): ...here.
	(_Jv_ThreadStart): Set PTHREAD_CREATE_DETACHED.
	* win32-threads.cc (_Jv_ThreadInitData): Implement new prototype.
	(_Jv_ThreadDestroyData): Implemented.
	* nogc.cc (_Jv_AllocObject): Use "void *" not "ptr_t".
	(_Jv_AllocArray): Ditto.

From-SVN: r38557
This commit is contained in:
Bryce McKinlay 2000-12-30 12:18:39 +00:00 committed by Bryce McKinlay
parent 4c2f5b4fd3
commit e301621d19
14 changed files with 171 additions and 59 deletions

View file

@ -147,7 +147,7 @@ _Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu,
else
r = pthread_cond_timedwait (&current->wait_cond, &current->wait_mutex,
&ts);
// In older glibc's (prior to 2.1.3), the cond_wait functions may
// spuriously wake up on a signal. Catch that here.
if (r != EINTR)
@ -297,20 +297,25 @@ _Jv_InitThreads (void)
sigaction (INTR, &act, NULL);
}
void
_Jv_ThreadInitData (_Jv_Thread_t **data, java::lang::Thread *obj)
_Jv_Thread_t *
_Jv_ThreadInitData (java::lang::Thread *obj)
{
_Jv_Thread_t *info = new _Jv_Thread_t;
info->flags = 0;
info->thread_obj = obj;
_Jv_Thread_t *data = new _Jv_Thread_t;
data->flags = 0;
data->thread_obj = obj;
pthread_mutex_init (&info->wait_mutex, NULL);
pthread_cond_init (&info->wait_cond, NULL);
pthread_mutex_init (&data->wait_mutex, NULL);
pthread_cond_init (&data->wait_cond, NULL);
// FIXME register a finalizer for INFO here.
// FIXME also must mark INFO somehow.
return data;
}
*data = info;
void
_Jv_ThreadDestroyData (_Jv_Thread_t *data)
{
pthread_mutex_destroy (&data->wait_mutex);
pthread_cond_destroy (&data->wait_cond);
delete data;
}
void
@ -352,12 +357,6 @@ really_start (void *x)
pthread_mutex_unlock (&daemon_mutex);
}
#ifndef LINUX_THREADS
// Clean up. These calls do nothing on Linux.
pthread_mutex_destroy (&info->data->wait_mutex);
pthread_cond_destroy (&info->data->wait_cond);
#endif /* ! LINUX_THREADS */
return NULL;
}
@ -377,6 +376,7 @@ _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data,
pthread_attr_init (&attr);
pthread_attr_setschedparam (&attr, &param);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
// FIXME: handle marking the info object for GC.
info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter));