|
From: Daniel J S. <dan...@ie...> - 2012-01-05 11:33:48
|
On 01/05/2012 05:10 AM, Mojca Miklavec wrote: > On Thu, Jan 5, 2012 at 08:35, Daniel J Sebald wrote: >> >> If it is >> the former, then perhaps Qt users should not be using fork, but QThread. > > As already said, I don't know anything about forking, but it is also > not clear to me why forking or creating a new binary is needed at all. The reason is (as from what I read about Qt and my limited understanding) QApplication has to be the only event loop in a process. It cannot run as an event loop along with a process that is also running an event loop. In other words, gnuplot (an event loop) can't coexist with QApplication GUI (an event loop because it is processing button/keyboard/other events). A fork is simply a means of creating another process, at least for most high level applications. (Low level, there are other aspects of the duplication from fork that can be utilized, but not important here.) > Here is an example of communication between GUI and Threads: > > http://developer.qt.nokia.com/doc/qt-4.8/thread-basics.html#example-3-clock Those are threads within the Qt application, which isn't exactly the same as the OS threads commonly thought of. The example you show has a main() routine for which QApplication is the only event loop. The other elements are QObjects and such. The issue is: 1) QApplication must be the only event loop, i.e., being able to run a QApplication GUI and gnuplot simultaneously. (Hence the need for fork...why Qt doesn't handle this is what I asked before.) 2) Dealing with the Mac OS X limitation that CoreFoundation APIs (which Qt uses) cannot appear in a child process any longer. (Hence the need for fork + exec and a separate binary.) Dan > > Mojca > > ------------------------------------------------------------------------------ > Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex > infrastructure or vast IT resources to deliver seamless, secure access to > virtual desktops. With this all-in-one solution, easily deploy virtual > desktops for less than the cost of PCs and save 60% on VDI infrastructure > costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta -- Dan Sebald email: daniel(DOT)sebald(AT)ieee(DOT)org URL: http://www(DOT)dansebald(DOT)com |