From f8c8e13b7e16dba8c04adc6912a0610292488656 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sun, 24 Nov 2002 13:54:14 +0000 Subject: 2002-11-05 Thomas Pfaff * dcrt0.cc (dll_crt0_1): Add call to pthread::initMainThread to initialize mainthread when it is safe to call new. * init.cc (dll_entry): Change call to store reents in tls key. * thread.cc (_reent_clib) : Change call to get reents from tls key. (_reent_winsup): Ditto. (MTinterface::Init): Key handling changed. Remove initialization of member variables. (MTinterface::fixup_after_fork): Reinitialize mainthread object after fork. Reset threadount to 1. (pthread::initMainThread): Create mainthread object dynamically. and initialize with valid handles. (pthread::self): Remove calls to create thread objects. (pthread::setTlsSelfPointer): Change call to store thread self handle in tls key. (pthread::getTlsSelfPointer): New static method. (pthread::exit): Remove setTlsSelfPointer call. (pthread::initCurrentThread): New method. (pthread::thread_init_wrapper): Change call to store thread self handle in tls key. (pthread::join): Check for a valid joiner. (pthreadNull::pthreadNull): Mark Null object as detached. (pthreadNull::exit): Terminate thread via ExitThread. * thread.h (pthread::initMainThread): Change parameter in function call. (pthread::getTlsSelfPointer): New static method. (pthread::initCurrentThread): New method. (MTinterface::reent_key): Remove. (MTinterface::thread_self_dwTlsIndex): Ditto.. (MTinterface::indexallocated): Ditto. (MTinterface::mainthread): Ditto. (MTinterface::reent_key): New member. (MTinterface::thread_self_key): Ditto. (MTinterface::MTinterface): Initialize all members. --- winsup/cygwin/dcrt0.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'winsup/cygwin/dcrt0.cc') diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 22899e452..6c6acbd37 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -628,6 +628,8 @@ dll_crt0_1 () ProtectHandle (hMainThread); cygthread::init (); + pthread::initMainThread (!user_data->forkee); + /* Initialize debug muto, if DLL is built with --enable-debugging. Need to do this before any helper threads start. */ debug_init (); -- cgit v1.2.3