RE: status of fileevent support? (for use with Tcl::pTk)
[email protected] ("Konovalov, Vadim") Mon, 30 Jul 2018 10:08:59 +0000
| Newsgroups | perl.tcltk |
|---|---|
| Message-ID | <[email protected]> |
> 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 filehandle= s; it > might be sufficient to use Tcl syntax to open a read handle for the devic= e 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 mode= rn > module like IO::Async in the same thread with e.g. Tcl::pTk due to separa= te > event loops. If combining the file handles is best, that seems like somet= hing > 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= =20 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 p= referred=20 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.