* DevNotes: Add entry cgf-000011.

* fhandler.h (fhandler_base::refcnt): Delete.
(fhandler_base::inc_refcnt): New function.
(fhandler_base::dec_refcnt): New function.
* cygheap.h (cygheap_fdnew::~cygheap_fdnew): Accommodate split of refcnt to
inc_refcnt/dec_refcnt.
(cygheap_fdget::cygheap_fdget): Ditto.
(cygheap_fdget::~cygheap_fdget::cygheap_fdget): Ditto.
* dtable.cc (dtable::release): Ditto.
(cygwin_attach_handle_to_fd): Ditto.
(dtable::init_std_file_from_handle): Ditto.
(dtable::dup3): On success, return with fdtab locked.
* dtable.h (dtable): Add dup_finish as a friend.
* syscalls.cc (dup_finish): Define new function.  Increment refcnt while fdtab
is locked.
(dup2): Use common dup_finish() to perform dup operation.
(dup3): Ditto.
This commit is contained in:
Christopher Faylor
2012-06-03 18:02:45 +00:00
parent ff80d22a7c
commit 3143cb7c00
7 changed files with 74 additions and 20 deletions

View File

@ -458,7 +458,7 @@ class cygheap_fdnew : public cygheap_fdmanip
~cygheap_fdnew ()
{
if (cygheap->fdtab[fd])
cygheap->fdtab[fd]->refcnt (1);
cygheap->fdtab[fd]->inc_refcnt ();
}
void operator = (fhandler_base *fh) {cygheap->fdtab[fd] = fh;}
};
@ -476,7 +476,7 @@ public:
this->fd = fd;
locked = lockit;
fh = cygheap->fdtab[fd];
fh->refcnt (1);
fh->inc_refcnt ();
}
else
{
@ -491,7 +491,7 @@ public:
}
~cygheap_fdget ()
{
if (fh && fh->refcnt (-1) <= 0)
if (fh && fh->dec_refcnt () <= 0)
{
debug_only_printf ("deleting fh %p", fh);
delete fh;