* cygheap.h (cygheap_fdget::~cygheap_fdget): Simplify now that refcnt reports

reference count changes itself.
* fhandler.cc (fhandler_base::reset): Set _refcnt to 0.
* fhandler.h (fhandler_base::refcnt): Report refcnt when debugging.
* select.cc (cygwin_select): Set return_on_signal to indicate when select
should be interrupted.
(select_stuff::wait): Keep looping unless return_on_signal is set.
* select.h (select_stuff::return_on_signal): New variable.
(select_stuff::select_stuff): Zero return_on_signal.
This commit is contained in:
Christopher Faylor 2012-01-22 06:45:08 +00:00
parent 5259273091
commit ad87edbe61
7 changed files with 37 additions and 17 deletions

View File

@ -1,3 +1,16 @@
2012-01-22 Christopher Faylor <me.cygwin2012@cgf.cx>
* cygheap.h (cygheap_fdget::~cygheap_fdget): Simplify now that refcnt
reports reference count changes itself.
* fhandler.cc (fhandler_base::reset): Set _refcnt to 0.
* fhandler.h (fhandler_base::refcnt): Report refcnt when debugging.
* select.cc (cygwin_select): Set return_on_signal to indicate when
select should be interrupted.
(select_stuff::wait): Keep looping unless return_on_signal is set.
* select.h (select_stuff::return_on_signal): New variable.
(select_stuff::select_stuff): Zero return_on_signal.
2012-01-20 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_registry::opendir): Declare.

View File

@ -1,7 +1,7 @@
/* cygheap.h: Cygwin heap manager.
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011 Red Hat, Inc.
2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@ -401,13 +401,9 @@ public:
}
~cygheap_fdget ()
{
if (!fh)
/* nothing to do */;
else if (fh->refcnt (-1) > 0)
debug_only_printf ("fh %p, %s, refcnt %ld", fh, fh->get_name (), fh->refcnt ());
else
if (fh && fh->refcnt (-1) <= 0)
{
debug_only_printf ("deleting fh %p, %s, refcnt %ld", fh, fh->get_name (), fh->refcnt ());
debug_only_printf ("deleting fh %p", fh);
delete fh;
}
}

View File

@ -1,7 +1,7 @@
/* fhandler.cc. See console.cc for fhandler_console functions.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@ -50,6 +50,7 @@ fhandler_base::reset (const fhandler_base *from)
raixget = 0;
raixput = 0;
rabuflen = 0;
_refcnt = 0;
}
int

View File

@ -178,7 +178,11 @@ class fhandler_base
HANDLE read_state;
public:
long refcnt(long i = 0) {return _refcnt += i;}
long refcnt(long i = 0)
{
debug_only_printf ("%p, %s, i %d, refcnt %ld", this, get_name (), i, _refcnt + i);
return _refcnt += i;
}
class fhandler_base *archetype;
int usecount;

View File

@ -1,7 +1,7 @@
/* fhandler_registry.cc: fhandler for /proc/registry virtual filesystem
Copyright 2002, 2003, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011 Red Hat, Inc.
2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.

View File

@ -1,7 +1,7 @@
/* select.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@ -130,16 +130,17 @@ cygwin_select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
fd_set *e = allocfd_set (maxfds);
int res = 0;
sel.return_on_signal = &_my_tls == _main_tls;
/* Degenerate case. No fds to wait for. Just wait. */
if (sel.start.next == NULL)
while (!res)
switch (cygwait (ms))
{
case WAIT_OBJECT_0:
_my_tls.call_signal_handler ();
if (&_my_tls != _main_tls)
continue; /* Emulate linux behavior */
select_printf ("signal received");
_my_tls.call_signal_handler ();
if (!sel.return_on_signal)
continue; /* Emulate linux behavior */
set_sig_errno (EINTR);
res = -1;
break;
@ -328,8 +329,11 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
switch (wait_ret)
{
case WAIT_OBJECT_0:
cleanup ();
select_printf ("signal received");
_my_tls.call_signal_handler ();
if (!return_on_signal)
continue; /* Emulate linux behavior */
cleanup ();
set_sig_errno (EINTR);
return -1;
case WAIT_OBJECT_0 + 1:

View File

@ -1,7 +1,7 @@
/* select.h
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@ -70,6 +70,7 @@ class select_stuff
{
public:
~select_stuff ();
bool return_on_signal;
bool always_ready, windows_used;
select_record start;
@ -84,7 +85,8 @@ public:
int wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds, DWORD ms);
void cleanup ();
void destroy ();
select_stuff (): always_ready (0), windows_used (0), start (0),
select_stuff (): return_on_signal (false), always_ready (false),
windows_used (false), start (0),
device_specific_pipe (0),
device_specific_socket (0),
device_specific_serial (0),