[Kde-bindings] QThread through smoke?
Caleb Tennis
caleb at gentoo.org
Sat Feb 12 15:00:14 UTC 2005
> But maybe it would be better to look into why ruby blocks. Have you tried
> something like 'mystream.sync = true'? Or have you got a small sample of
> code that reproduces the problem - it's difficult to know what it could be
> without seeing it and trying it out.
Yeah, I posted a snippet the other day on the ruby-talk mailing list because I
couldn't figure out what was going on. I'm talking to a device on a serial
port, and waiting for a reply (using simple read/write IO on /dev/tts/x). An
strace (and a reply from some users) shows that ruby uses select() for
polling reads in subthreads but doesn't do it for the main thread - which
causes the port to block for a little bit (==half a second or so) before
reading the data back. Running the exact same code in the main thread
doesn't exhibit the behavior.
I hadn't thought of using QSocketNotifier, and I can't see why it wouldn't
work. I'm mainly just refactoring the same methodologies used in pure Qt
program. I'll continue playing with the QThread stuff and see if I can find
any gotchas - otherwise I'll probably switch over to a SocketNotifier like
you suggested
> Does it need multithreading - could you do something with
> Qt::SocketNotifiers for input and output connected to slots to read and
> write, and let Qt coordinate the app in that way?
>
> -- Richard
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings
More information about the Kde-bindings
mailing list