delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/05/09:36:05

X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: converse of cygwin_attach_handle_to_fd()?
Date: Mon, 5 Jun 2006 14:35:49 +0100
Message-ID: <003201c688a4$f651d510$a501a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <20060603230954.GT4441@bouh.residence.ens-lyon.fr>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 04 June 2006 00:10, Samuel Thibault wrote:

> Hi,
> 
> cygwin_attach_handle_to_fd() lets create a cygwin fd on top of a windows
> handle. When calling close() on the fd, the windows handle is closed
> too. Is there any way to close the fd without closing the underlying
> handle? (i.e. the converse of cygwin_attach_handle_to_fd(), actually)

  Well, the simple workaround would be to write a wrapper function for
cygwin_attach_handle_to_fd; the wrapper would call DuplicateHandle to get a
spare copy of the original handle and then pass that duplicated handle to
cygwin_attach_handle_to_fd instead of the original handle; that way, when you
close the fd, the duplicate of the handle is closed, entirely independently of
the original.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019