diff options
author | Christopher Faylor <me@cgf.cx> | 2004-05-16 04:18:50 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-05-16 04:18:50 +0000 |
commit | 0c565ab35b47c29c0d5ba7a6e28ca63535776ce8 (patch) | |
tree | 3c5c40d2bb4eb150ee58f043bbec30d1032c2a74 /winsup/cygwin/sync.h | |
parent | aafd8a545f7d9089d47ac28d890840f22dac6df4 (diff) | |
download | cygnal-0c565ab35b47c29c0d5ba7a6e28ca63535776ce8.tar.gz cygnal-0c565ab35b47c29c0d5ba7a6e28ca63535776ce8.tar.bz2 cygnal-0c565ab35b47c29c0d5ba7a6e28ca63535776ce8.zip |
* cygthread.cc (cygthread::is): Eliminate.
* cygthread.h (cygthread::is): Eliminate declaratin.
* fhandler_console.cc (fhandler_console::read): Only wait for signal_arrived in
the main thread.
* fhandler_socket.cc: Include new "wininfo.h".
(fhandler_socket::ioctl): Use 'winmsg' rather than 'gethwnd()'.
* sync.cc (muto::grab): Define new function.
(muto::acquire): Use tls pointer rather than tid.
(muto::acquired): Ditto.
(muto::reset): Delete.
(muto::release): Ditto. Also implement "close on last release".
* sync.h (muto::tid): Delete.
(muto::tls): New field.
(muto::ismine): Delete.
(muto::owner): Delete.
(muto::unstable): Delete.
(muto::reset): Delete.
(muto::upforgrabs): New method.
(muto::grab): Ditto.
(new_muto_name): New define.
* wininfo.h: New file.
(wininfo): New class.
* window.cc: Rework throughout to use winfo class for controlling invisible
window operation.
(gethwnd): Delete definition.
* winsup.h (gethwnd): Delete declaration.
Diffstat (limited to 'winsup/cygwin/sync.h')
-rw-r--r-- | winsup/cygwin/sync.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h index 24de97428..7e8b60c10 100644 --- a/winsup/cygwin/sync.h +++ b/winsup/cygwin/sync.h @@ -22,7 +22,7 @@ class muto HANDLE bruteforce; /* event handle used to control waiting for lock. */ public: LONG visits; /* Count of number of times a thread has called acquire. */ - DWORD tid; /* Thread Id of lock owner. */ + void *tls; /* Tls of lock owner. */ // class muto *next; const char *name; @@ -35,12 +35,9 @@ public: int acquire (DWORD ms = INFINITE) __attribute__ ((regparm (2))); /* Acquire the lock. */ int release () __attribute__ ((regparm (1))); /* Release the lock. */ - /* Return true if caller thread owns the lock. */ - int ismine () {return tid == GetCurrentThreadId ();} - DWORD owner () {return tid;} - int unstable () {return !tid && (sync || waiters >= 0);} - void reset () __attribute__ ((regparm (1))); - bool acquired (); + bool acquired () __attribute__ ((regparm (1))); + void upforgrabs () {tls = this;} // just set to an invalid address + void grab () __attribute__ ((regparm (1))); static void set_exiting_thread () {exiting_thread = GetCurrentThreadId ();} }; @@ -59,4 +56,11 @@ extern muto muto_start; static muto __storage __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy1"))); \ __name = __storage.init (#__name); \ }) + +/* Use a statically allocated buffer as the storage for a muto */ +#define new_muto_name(__var, __name) \ +({ \ + static muto __var##_storage __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy1"))); \ + __var = __var##_storage.init (__name); \ +}) #endif /*_SYNC_H*/ |