diff options
author | Christopher Faylor <me@cgf.cx> | 2000-02-24 19:54:01 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-02-24 19:54:01 +0000 |
commit | d3bda1df95dd1e368ec03b1a1b9e3f0260b4cbfc (patch) | |
tree | fae6cee1f065d106fc2fe2e731d238973b4125fc /winsup/cygwin/sync.h | |
parent | 4bc3b73cfde68ab05ce7351cf57156ece6433548 (diff) | |
download | cygnal-d3bda1df95dd1e368ec03b1a1b9e3f0260b4cbfc.tar.gz cygnal-d3bda1df95dd1e368ec03b1a1b9e3f0260b4cbfc.tar.bz2 cygnal-d3bda1df95dd1e368ec03b1a1b9e3f0260b4cbfc.zip |
* exceptions.cc (call_handler): Use new muto linked list to look for all
potential mutos owned by suspended thread. Clear waiting threads while thread
is stopped.
(proc_subproc): Clarify debugging output.
* sync.h (class muto): Add 'next' field.
(new_muto): Keep linked list alive.
Diffstat (limited to 'winsup/cygwin/sync.h')
-rw-r--r-- | winsup/cygwin/sync.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h index 3dcc915da..7215c2bd7 100644 --- a/winsup/cygwin/sync.h +++ b/winsup/cygwin/sync.h @@ -20,6 +20,7 @@ class muto HANDLE bruteforce; /* event handle used to control waiting for lock. */ DWORD tid; /* Thread Id of lock owner. */ public: + class muto *next; void *operator new (size_t, void *p) {return p;} void *operator new (size_t) {return ::new muto; } void operator delete (void *) {;} /* can't handle allocated mutos @@ -27,7 +28,7 @@ public: /* This simple constructor is used for cases where no bruteforce event handling is required. */ - muto(): sync(0), visits(0), waiters(-1), bruteforce(0), tid(0) {;} + muto(): sync(0), visits(0), waiters(-1), bruteforce(0), tid(0), next (0) {;} /* A more complicated constructor. */ muto(int inh, const char *name); ~muto (); @@ -40,11 +41,14 @@ public: int unstable () {return !tid && (sync || waiters >= 0);} }; +extern muto muto_start; + /* Use a statically allocated buffer as the storage for a muto */ #define new_muto(__inh, __name) \ ({ \ static NO_COPY char __mbuf[sizeof(class muto) + 100] = {0}; \ - muto *m; \ - m = new (__mbuf) muto ((__inh), (__name)); \ - m; \ + muto *m = muto_start.next; \ + muto_start.next = new (__mbuf) muto ((__inh), (__name)); \ + muto_start.next->next = m; \ + muto_start.next; \ }) |