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
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/sync.cc')
-rw-r--r--winsup/cygwin/sync.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/winsup/cygwin/sync.cc b/winsup/cygwin/sync.cc
index aa3978fe0..31bb27bdc 100644
--- a/winsup/cygwin/sync.cc
+++ b/winsup/cygwin/sync.cc
@@ -25,7 +25,7 @@ details. */
muto NO_COPY muto_start;
/* Constructor */
-muto::muto(int inh, const char *name) : sync (0), visits(0), waiters(-1), tid (0), next (NULL)
+muto::muto(int inh, const char *s) : sync (0), visits(0), waiters(-1), tid (0), next (NULL)
{
/* Create event which is used in the fallback case when blocking is necessary */
if (!(bruteforce = CreateEvent (inh ? &sec_all_nih : &sec_none_nih, FALSE, FALSE, name)))
@@ -34,14 +34,20 @@ muto::muto(int inh, const char *name) : sync (0), visits(0), waiters(-1), tid (0
SetLastError (oerr);
return;
}
+ name = s;
}
-/* Destructor */
+/* Destructor (racy?) */
muto::~muto ()
{
+ while (visits)
+ release ();
+
+ HANDLE h = bruteforce;
+ h = NULL;
/* Just need to close the event handle */
- if (bruteforce)
- CloseHandle (bruteforce);
+ if (h)
+ CloseHandle (h);
}
/* Acquire the lock. Argument is the number of milliseconds to wait for