Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Labltk.Fileevent for both r and w
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-13 (18:49)
From: Max Kirillov <max630@m...>
Subject: [Caml-list] Labltk.Fileevent for both r and w

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


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: