> For the program I'm working on (cf.
> https://github.com/hotwolf/HSW12/issues/16) the existing fileevent is for
> reading a serial port. It already uses separate read and write filehandles; it
> might be sufficient to use Tcl syntax to open a read handle for the device and
> make a fileevent for it (from Tcl rather than Perl), while continuing to use a
> Perl write filehandle in UI event callbacks.
> For other uses, I'm not quite sure
> what the best approach will be. It doesn't seem possible to use some modern
> module like IO::Async in the same thread with e.g. Tcl::pTk due to separate
> event loops. If combining the file handles is best, that seems like something
> needing to be done from C/XS (not pure Perl or Tcl), which is what using
> Tcl_CreateFileHandler would entail.

My personal preference is to avoid perl threads - always, even with careful 
separation - GUI for one thread and all other for another.

Perl threads are officially discouraged, so I don't.

A point with different event loops for IO::Async and Tcl-based GUI-or-IO is a 
problem, indeed.

A question - is it still a problem for perl/Tk? (actually I think so)

Spinning 2 event loops is impossible, either by 2 threads or by one single 
thread
with any tricks or whistles or prays.

This means that a solution with tcl-only GUI and async-io is actually the 
preferred 
one.

IOW you're correct with 'fileevent' question, :)

In case you see that pure-tcl not possible and indeed you need to
use API, including Tcl_CreateFileHandler, we could happily add that to XS.

Reply via email to