From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA07831; Thu, 13 Mar 2003 19:49:32 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA07674 for ; Thu, 13 Mar 2003 19:49:31 +0100 (MET) Received: from viola.sinor.ru (viola.sinor.ru [217.70.106.9]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h2DInUX21953 for ; Thu, 13 Mar 2003 19:49:30 +0100 (MET) Received: from sibnet.ru (tlg5-ppp47.sibnet.ru [217.70.116.47]) by viola.sinor.ru (8.12.8/8.12.3) with ESMTP id h2DInPdu029578 for ; Fri, 14 Mar 2003 00:49:27 +0600 Received: by sibnet.ru id m18tXZp-001EpaC; Fri, 14 Mar 2003 00:37:13 +0600 (NOVT) Date: Fri, 14 Mar 2003 00:37:13 +0600 From: Max Kirillov To: caml-list@inria.fr Subject: [Caml-list] Labltk.Fileevent for both r and w Message-ID: <20030314003713.E748@max.home> Mail-Followup-To: caml-list@inria.fr Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i X-Sender: Max X-Spam: no; 0.00; kirillov:01 labltk:01 fileevent:01 fileinput:01 val:01 otherlibs:01 callback:01 installes:99 ocaml:01 handler:01 sockets:01 readable:01 exists:01 pipes:03 versa:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello! I've noted that I cannot set both Fileevent.add_fileinput and Fileevent.add_fileoutput. A short course to sources showed that is seems to be true: when you call Tcl_CreateFileHandler(tcl_filehandle(fd), TCL_READABLE, FileProc, (ClientData)(Long_val(cbid))); from the otherlibs/labltk/support/cltkFile.c (camltk_add_file_input), it removes the handler for writing, according to There may exist only one handler for a given file at a given time. If Tcl_CreateFileHandler is called when a handler already exists for fd, then the new callback replaces the information that was previ­ ously recorded. (from Tcl_CreateFileHandler(3)) And vice versa. This is not very useful on ordinary files and pipes, but it is on sockets and some devices. This may be worked around using dup, but it is greatly unconvenient. Is there an option to enable the coexistence of the handlers? I see it making one function camltk_{add/remove}_file_io, which installes some wrapper for the case of two handlers, and then the wrapper chooses the right handler accordind to the mode. This may be done either in C code (in function FileProc in the same file) or in ocaml. -- Max ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners