Hi all,
I've got some weird behaviour with my little python app. It opens up a video 
device and streams the images to pyGTK window.

It basically works OK but occasionally has issues when stopping the stream. It 
appears to get stuck in a while loop whilst waiting for a signal to clear.

So questions:
1) is waiting for a signal to clear in this manner the best approach.
2) is there a way to debug what is really happening in the various threads?

A code snippet is:
--
class pyv4l2_grabber(threading.Thread):
--
   def stop_stream(self):
      if self.active == 1:
         self.event_stop_stream.set()
         self.active = 0
         while self.event_stop_stream.isSet():
            time.sleep(0.1)
         print "stopped capture, frame rate was ",
(self.frame_count /(self.end_time - self.start_time))
--

It appears that when 'stop' fails I can wait as long as I want, but when ever I 
press control-C it reports:
--
CTraceback (most recent call last):
  File "./pyDataMatrixScanner.py", line 329, in button2_clicked
    self.videodevice.stop_stream()
  File "./pyDataMatrixScanner.py", line 170, in stop_stream
    time.sleep(0.1)
KeyboardInterrupt
--


The code which actually draws the image to the screen/gtk-pixmap is surrounded 
by:
--
gtk.gdk.threads_enter()
...
gtk.gdk.threads_leave()
--

which seem to be required for speed. If these are removed (or the drawing to 
screen is disabled) the lockup does not occur.... very strange.

Any suggestions?
Simon.

_______________________________________________
clug-talk mailing list
[email protected]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying

Reply via email to