This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Using the fd's underlying guile fports


The library I'm writing glue code for has a trace feature which results in
a low-level trace being written to a specified (FILE *) passed in. To make
this flexible I would like to be able to accept any fport as an argument
to the trace function. That way trace could be done to any stream very
easily, without my having to write code to do fopen popen etc.

However there is a potential problem with the port being written to or
read from by guile whilst it's underlying fd is written to from the
third-party library.

It seems that this will be a common situation. Does anyone see any merit
in having some sort of locking mechanism in the ports interface to prevent
scheme-level access to ports whose underlying file descriptors are in use?
This could be just a count, bumped each time the underlying fd is
obtained, and decremented each time it is released. Any attempt to read or
write or seek on the port should result in an error of some kind. Is this
by any chance what the revealed count is? 

Ian



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]