summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/sync.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-02-14 21:20:06 +0000
committerChristopher Faylor <me@cgf.cx>2002-02-14 21:20:06 +0000
commit907dc7d0c9f64d95b6d4da91dab6601d0e6054ec (patch)
tree09bc7dae25c4c1f67767dfc04fb1ee4c3a08c371 /winsup/cygwin/sync.cc
parent27530c31810976dec063f8ffdc6709945dfcef39 (diff)
downloadcygnal-907dc7d0c9f64d95b6d4da91dab6601d0e6054ec.tar.gz
cygnal-907dc7d0c9f64d95b6d4da91dab6601d0e6054ec.tar.bz2
cygnal-907dc7d0c9f64d95b6d4da91dab6601d0e6054ec.zip
* exceptions.cc (unused_sig_wrapper): Eliminate unused parameter to asm.
* external.cc (cygwin_internal): Change CW_STRACE_ON to CW_STRACE_TOGGLE. * strace.cc (strace::hello): Toggle strace on and off. * sync.cc (muto::init): Renamed from constructor. * sync.h (muto::new): Delete. (muto::delete): Ditto. (new_muto): Simplify. Use muto.init for nearly everything. * uinfo.cc (uinfo_init): Avoid closing a NULL handle. * include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_STRACE_OFF to CW_STRACE_TOGGLE. Delete CW_STRACE_OFF. * include/sys/strace.h (strace): Add "inited" field.
Diffstat (limited to 'winsup/cygwin/sync.cc')
-rw-r--r--winsup/cygwin/sync.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/winsup/cygwin/sync.cc b/winsup/cygwin/sync.cc
index 743ee02e7..1b5145aa4 100644
--- a/winsup/cygwin/sync.cc
+++ b/winsup/cygwin/sync.cc
@@ -28,18 +28,24 @@ muto NO_COPY muto_start;
#undef WaitForSingleObject
/* Constructor */
-muto::muto (int inh, const char *s) : sync (0), visits(0), waiters(-1), tid (0), next (NULL)
+muto *
+muto::init (int inh, const char *s)
{
+ waiters = -1;
/* 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)))
+ if (!(bruteforce = CreateEvent (inh ? &sec_all_nih : &sec_none_nih, FALSE, FALSE, NULL)))
{
DWORD oerr = GetLastError ();
SetLastError (oerr);
- return;
+ return NULL;
}
name = s;
+ next = muto_start.next;
+ muto_start.next = this;
+ return this;
}
+#if 0 /* FIXME: Do we need this? mutos aren't destroyed until process exit */
/* Destructor (racy?) */
muto::~muto ()
{
@@ -52,6 +58,7 @@ muto::~muto ()
if (h)
CloseHandle (h);
}
+#endif
/* Acquire the lock. Argument is the number of milliseconds to wait for
the lock. Multiple visits from the same thread are allowed and should