in reply to Re: Sharing Tk-module objects in threads
in thread Sharing Tk-module objects in threads

I liked your comments, but say I have a long running sql query using DBI which blocks. Do you think you could demonstrate your technique using with a long running DBI query inside of Tk that would work on a Win32 machine? The main window will not refresh while DBI runs unless you separate that process somehow. I have a hack that works, but I am interested in seeing an example of what you are saying.
Thanks so much!
JamesNC
  • Comment on Re^2: Sharing Tk-module objects in threads

Replies are listed 'Best First'.
Re^3: Sharing Tk-module objects in threads
by thospel (Hermit) on Nov 05, 2004 at 12:51 UTC
    Unfortunately the case you are describing there is indeed one that can't be solved in the normal callback style. That assumes you can split up the work in pieces that never block for a long time. A long running query invalidates that assumption. So for that case you must indeed use a separate process/thread or use an event driven database library (which means not directly using DBI. Even though there are plans for it, DBI is currently not event driven).

    Though even in the case of a separate process I'd normally set up a socket or pipe style connection between the GUI process and the DBI process and handle the socket/pipe events with I/O callbacks at the GUI side. The DBI side would probably be straightfoward code doing blocking calls.