Menu

#48 Non-blocking behaviour for python bindings

version_0.10
open-fixed
spadix
5
2011-02-13
2011-02-11
Max
No

As discussed in forum thread: https://sourceforge.net/projects/zbar/forums/forum/664596/topic/4094292

Current python Processor bindings do not support threading.

Discussion

  • Max

    Max - 2011-02-11

    Another idea is to use intermediate Video API to achieve non-blocking barcode processing in Python, but it seems to be not implemented in current bindings.

     
  • spadix

    spadix - 2011-02-13

    A fix for this has been pushed to hg (rev 1c14e19910e9).

    I did what testing I could, but do not currently have a camera setup, so it would be great if someone could test with video and report back here. Specifically we need tests for:
    * setting the processor active and receiving asynchronous calls from the data_handler (single Python thread)
    * ensuring that time consuming processor methods (user_wait, process_one, process_image) do not block other threads

    Thanks for reporting this!

     
  • spadix

    spadix - 2011-02-13
    • status: open --> open-fixed
     
  • Max

    Max - 2011-02-13

    zbar threading test

     
    • afnfun

      afnfun - 2013-06-17

      Hello everybody
      I know that the discussion is old but I have the same case.
      I have tried to use this code with 'wait' mode but the process still blocking other threads!
      only if I add time.sleep(2) inside the process_data() then I got 2 sec unblock time for other processes.

       
      • afnfun

        afnfun - 2013-06-17

        do I need to use a specific version of Zbar ?

         
  • Max

    Max - 2011-02-13

    Thanks, nice work! I updated my test script (attached). There are four modes:

    normal mode (just activates processor): zbar_threads_test.py
    user wait mode: zbar_threads_test.py wait
    process one mode: zbar_threads_test.py one
    scan image mode: zbar_threads_test.py image /path/to/image

    So far everything looks good - main thread is not stalled and periodically emits alive message. Asynchronous data processing hook is also being called.

     
  • spadix

    spadix - 2011-02-14

    Thanks again for the testing. btw- if you can find a way to automate these tests, I'll certainly add them to the test suite...

     

Log in to post a comment.