diff options
Diffstat (limited to 'winsup/cygwin/fhandler.h')
-rw-r--r-- | winsup/cygwin/fhandler.h | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 84f6e4c3f..72f8d8429 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -182,15 +182,8 @@ class fhandler_base HANDLE read_state; public: - long refcnt(long i = 0) - { - debug_only_printf ("%p, %s, i %d, refcnt %ld", this, get_name (), i, _refcnt + i); - /* This MUST be an interlocked operation. If multiple threads access the - same descriptor in quick succession, a context switch can interrupt - the += operation and we wrongly end up with a refcnt of 0 in the - cygheap_fdget destructor. */ - return i ? InterlockedAdd (&_refcnt, i) : _refcnt; - } + long inc_refcnt () {return InterlockedIncrement (&_refcnt);} + long dec_refcnt () {return InterlockedDecrement (&_refcnt);} class fhandler_base *archetype; int usecount; |