From fa35a1ee5c602b765ca8a2886b2062971f871c47 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 3 Oct 2005 17:23:54 +0000 Subject: * cygheap.h (class process_lock): New class. * dtable.h (class dtable): Add class process_lock as a friend. * dcrt0.cc (get_exit_lock): Delete. (do_exit): Use process_lock class instead of get_exit_lock. * exceptions.cc (signal_exit): Ditto. * pinfo.cc (pinfo::exit): Ditto. (_pinfo::commune_process): Set process lock around this whole function. (_pinfo::commune_request): Use process_lock rather than myself.lock. * pinfo.h (pinfo::_lock): Delete. (pinfo::initialize_lock): Delete. (pinfo::lock): Delete. (pinfo::unlock): Delete. * winsup.h (get_exit_lock): Delete declaration. --- winsup/cygwin/cygheap.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'winsup/cygwin/cygheap.h') diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index e5ce58f4d..059e01d2e 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -415,6 +415,27 @@ class cygheap_fdenum : public cygheap_fdmanip } }; +class process_lock +{ + bool skip_unlock; +public: + process_lock (bool exiting = false) + { + cygheap->fdtab.lock (); + skip_unlock = exiting; + if (exiting && exit_state < ES_SET_MUTO) + { + exit_state = ES_SET_MUTO; + muto::set_exiting_thread (); + } + } + ~process_lock () + { + if (!skip_unlock) + cygheap->fdtab.unlock (); + } +}; + class child_info; void __stdcall cygheap_fixup_in_child (bool); extern "C" { -- cgit v1.2.3