On Sat, Apr 05, 2003 at 09:39:32PM -0500, Greg Ward wrote:
> now. Mostly. (While the eject ioctl() is running in a background
> thread, the GUI is not responsive -- rather, events are buffered and
> replayed when the ioctl() returns and the background thread finishes.
> However, if I replace the ioctl() with a sleep(), then the GUI responds
> exactly as I expect. So I'm inclined to blame this on Linux rather than
> GTK: perhaps a blocking ioctl() blocks *all* threads of the current
Maybe, but I'm not entirely convinced. Let's see here:
> # ...later on...
> def start_eject (self, widget):
> # First update the GUI to reflect what we're about to do.
> ebutton = self.eject_button
> ebutton.set_sensitive(False)
> if self.cdrom.tray_open: # will close the drive tray
> status = "Closing CD-ROM drive tray..."
> ebutton.set_label("Eject")
> else: # will eject the disc
> status = "Ejecting CD..."
> ebutton.set_label("Close")
>
> self.statusbar.push(self.statusbar.get_context_id(""),
> status)
> gtk.mainiteration()
This message only gets printed *after* the CD ejects?
> # And then launch the thread that actually does it.
> print "launching eject/close thread..."
> thread = Thread(name="cdrom-eject", target=self.eject_cd)
> thread.start()
If you stick a print at this point, does it only appear *after* the CD
is ejected?
What about a GTK call?
> def eject_cd (self):
> print "eject/close thread (%r) starting" % get_thread_id()
> if self.cdrom.tray_open: # close the drive tray
> self.cdrom.closetray()
> else:
> self.cdrom.eject()
> gtk.idle_add(self.eject_done)
I'm trying to rack my brain here to understand why eject hangs. Maybe a
test here could be to run the actual eject/closetray using a separate
process running using system(). I'm pretty sure an exec*() shouldn't
block all the threads, but what do you think?
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/