On Fri, 7 Jun 2019 11:25:19 +0200
Gustaf Neumann <neum...@wu.ac.at> wrote:

> Working with the numeric file descriptors has the advantage that it can be
> passed around between interpreters/threads, etc., so it is well suited
> for multi threaded applications, the FDs of open files can be kept
> in nsvs, etc.).

... but has the disadvantage of leaving
the Tcl way of handling IO :-(

With the Tcl's ability to cut/splice channels between
threads, you could achieve the same thing AND be Tcl 
compatible. For this to work the writer thread needs
to do Tcl_Write/Tcl_Read and not only write/read so 
there should be changes there of course.

I am telling this because I just completed the ns_http
rewrite that handles more/less similar issue w.r.t
queued http reads/writes and I was using the same
cut/splice technique to open a channel in one and
read/write to it in the other thread.

In order to keep this option open and not to clutter
the Tcl API, the "ns_asyncwrite" should allow for

  ns_asyncwrite ?-channel chan | -fd fd? content

At some time, if needed, the writer can be expanded
to understand Tcl channels as well.
 
 




_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to