This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch will fix the pthread key related problems with fork (key value is restored after fork) and some minor fork related fixes. Changelog: 2002-08-15 Thomas Pfaff <tpfaff@gmx.net> * fork.cc (fork_child): fixup_after_fork call changed. (fork_parent): Added call to MTinterface->fixup_before_fork to save TLS values. (fork): Added critical section, fixup_before_fork will use a local key buffer that is not thread safe. * init.cc (dll_entry): Run pthread_key destructors on thread detach or process detach. Changed call to store reents. * thread.cc: pthread_key_destructor and pthread_key_destructor_list class has been removed. (_reent_clib): Modified call to get reent value. (_reent_winsup): Ditto. (MTinterface::Init): Rewritten. (MTinterface::init_pthread): New Method. (MTinterface::fixup_before_fork): Ditto. (MTinterface::fixup_after_fork): Restore key values. Initialize thread instance for main thread. (MTinterface::run_key_dtors): New method, replaces IterateNull. (pthread::self): Allocate a pthread instance if not already done. This will give a thread a valid thread self pointer if it was created by ServiceMain or CreateThread. (pthread::destructor): New method. (pthread::exit): IterateNull is now done on thread detach, the cleanup in the key destructor function. (pthread_key::pthread_key): Is now a list. (pthread_key::set): Return error code. (pthread_key::get): Protect Win32 LastError. (pthread_key::fixup_before_fork): Save actual value in buffer. (pthread_key::fixup_after_fork): Restore key value. (pthread::thread_init_wrapper): Modified due to key handling changes. (__pthread_setspecific): Return error if failed. * thread.h (class pthread_key): New members fork_buf and destructor. New methods fixup_before_fork and fixup_after_fork. (class pthread_key_destructor): Removed. (class pthread_key_destructor_list): Ditto. (pthread::destructor): New method. (MTinterface::keys): New member. (MTinterface::reent_key): Ditto. (MTinterface::thread_self_key): Ditto. (MTinterface::fork_lock): Ditto. (MTinterface::init_pthread): New method. (MTinterface::fixup_before_fork): Ditto. (MTinterface::run_key_dtors): Ditto. (MTinterface::init_crit_section): Ditto. Moved MT_INTERFACE define from thread.cc to thread.h.
Attachment:
pthread_fork.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |