* sync.h (muto::operator int): New operator.

(locker): Remove unused class.
(new_muto): Delete.
(new_muto1): Ditto.
(new_muto_name): Ditto.
* cygheap.cc (cygheap_setup_for_child): Reflect use of static storage for muto
rather than pointer.
(_csbrk): Ditto.
(_cmalloc): Ditto.
(_cmalloc): Ditto.
(_cfree): Ditto.
* cygheap.h (cwdstuff::cwd_lock): Ditto.
(cwdstuff::get_drive): Ditto.
* cygmalloc.h (__malloc_lock): Ditto.
(__malloc_unlock): Ditto.
* cygtls.cc (sentry::lock): Ditto.
(sentry::sentry): Ditto.
(~sentry): Ditto.
(_cygtls::init): Ditto.
* dcrt0.cc: Ditto.
(cygwin_atexit): Ditto.
(cygwin_exit): Ditto.
* debug.cc (lock_debug::locker): Ditto.
(lock_debug::lock_debug): Ditto.
(lock_debug::unlock): Ditto.
(debug_init): Ditto.
* dtable.cc (dtable::init_lock): Ditto.
* dtable.h (dtable::lock_cs): Ditto.
(dtable::lock): Ditto.
(dtable::unlock): Ditto.
* exceptions.cc (mask_sync): Ditto.
(sighold): Ditto.
(set_process_mask_delta): Ditto.
(set_signal_mask): Ditto.
(events_init): Ditto.
* grp.cc (pwdgrp::pwdgrp): Ditto.
* malloc_wrapper.cc (mallock): Ditto.
(malloc_init): Ditto.
* path.cc (cwdstuff::cwd_lock): Ditto.
(cwdstuff::get_hash): Ditto.
(cwdstuff::get_hash): Ditto.
(cwdstuff::init): Ditto.
(cwdstuff::set): Ditto.
(cwdstuff::get): Ditto.
* pwdgrp.h (pwdgrp::pglock): Ditto.
(pwdgrp::refresh): Ditto.
* sigproc.cc (sync_proc_subproc): Ditto.
(get_proc_lock): Ditto.
(proc_subproc): Ditto.
(_cygtls::remove_wq): Ditto.
(proc_terminate): Ditto.
(sigproc_init): Ditto.
* timer.cc (lock_timer_tracker::protect): Ditto.
(lock_timer_tracker::lock_timer_tracker): Ditto.
(lock_timer_tracker::~lock_timer_tracker): Ditto.
* wininfo.cc (wininfo::_lock;): Ditto.
(wininfo::winthread): Ditto.
(operator HWND): Ditto.
(wininfo::lock): Ditto.
(wininfo::release): Ditto.
* wininfo.h (wininfo::_lock;): Ditto.
This commit is contained in:
Christopher Faylor
2005-04-05 04:31:00 +00:00
parent 82ae6271ba
commit 322c131f9f
19 changed files with 159 additions and 118 deletions

View File

@@ -16,6 +16,9 @@ details. */
there are issues with malloc and fork. */
class muto
{
public:
const char *name;
private:
static DWORD exiting_thread;
LONG sync; /* Used to serialize access to this class. */
LONG waiters; /* Number of threads waiting for lock. */
@@ -24,10 +27,9 @@ public:
LONG visits; /* Count of number of times a thread has called acquire. */
void *tls; /* Tls of lock owner. */
// class muto *next;
const char *name;
/* The real constructor. */
muto *init(const char *name) __attribute__ ((regparm (3)));
muto *init (const char *) __attribute__ ((regparm (2)));
#if 0 /* FIXME: See comment in sync.cc */
~muto ()
@@ -38,35 +40,8 @@ public:
bool acquired () __attribute__ ((regparm (1)));
void upforgrabs () {tls = this;} // just set to an invalid address
void grab () __attribute__ ((regparm (1)));
operator int () const {return !!name;}
static void set_exiting_thread () {exiting_thread = GetCurrentThreadId ();}
};
class locker
{
muto *room;
public:
locker (muto *m) {room = m; room->acquire ();}
~locker () {room->release ();}
};
/* Use a statically allocated buffer as the storage for a muto */
#define new_muto(__name) \
({ \
static muto __name##_storage __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy1"))); \
__name = __name##_storage.init (#__name); \
})
/* Use a statically allocated buffer as the storage for a muto */
#define new_muto1(__name, __storage) \
({ \
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*/