Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2022-08-22 15:38:49 +0300
committerCorinna Vinschen <corinna@vinschen.de>2022-08-22 15:38:49 +0300
commit48a210a457c5608e29d3b97dd39d101e27ee0dd8 (patch)
treeeef72d88c0c1e9136ec203685b94a63290a7d771 /winsup
parentd6c50e630a3c51ebbab477f452bb8138408c5c2a (diff)
Cygwin: debugging: convert muto to SRWLOCK
this avoids having to call debug_init, because the SRWLOCK is statically initialized. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/dcrt0.cc4
-rw-r--r--winsup/cygwin/debug.cc23
2 files changed, 4 insertions, 23 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 9ea846e41..e1197092e 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -854,10 +854,6 @@ dll_crt0_1 (void *)
strace.microseconds ();
#endif
- /* Initialize debug muto, if DLL is built with --enable-debugging.
- Need to do this before any helper threads start. */
- debug_init ();
-
cygbench ("pre-forkee");
if (in_forkee)
{
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc
index efa101ba7..050ffd9dc 100644
--- a/winsup/cygwin/debug.cc
+++ b/winsup/cygwin/debug.cc
@@ -22,30 +22,16 @@ details. */
class lock_debug
{
- static muto locker;
+ static NO_COPY SRWLOCK lock;
public:
- lock_debug ()
- {
- locker.acquire (INFINITE);
- }
- void unlock ()
- {
- locker.release ();
- }
- ~lock_debug () {unlock ();}
- friend void debug_init ();
+ lock_debug () { AcquireSRWLockExclusive (&lock); }
+ ~lock_debug () { ReleaseSRWLockExclusive (&lock); }
};
-muto NO_COPY lock_debug::locker;
+SRWLOCK NO_COPY lock_debug::lock = SRWLOCK_INIT;
static bool mark_closed (const char *, int, HANDLE, const char *, bool);
-void
-debug_init ()
-{
- lock_debug::locker.init ("debug_lock");
-}
-
/* Find a registered handle in the linked list of handles. */
static handle_list *
find_handle (HANDLE h)
@@ -138,7 +124,6 @@ add_handle (const char *func, int ln, HANDLE h, const char *name, bool inh)
if ((hl = newh ()) == NULL)
{
- here.unlock ();
debug_printf ("couldn't allocate memory for %s(%d): %s(%p)",
func, ln, name, h);
return;