#3 imagesnap hangs when called in parallel

open
nobody
None
5
2013-12-11
2013-12-11
No

Our lab is using imagesnap 0.2.5 (thank you!). We are dealing with a specific issue with a dual-camera setup, and looking for advice or a workaround.

We had a script that calls imagesnap twice for two different cameras.

imagesnap -d "Cam1"
imagesnap -d "Cam2"
exit 0

This works correctly and takes 8 seconds. Rather than waiting 8 seconds for the two cameras, we would like to wait ~4 seconds (this is for a book scanning application, so that will cut down jobs by hours), so we tried to call imagesnap twice in parallel by backgrounding the job:

imagesnap -d "Cam1" &
imagesnap -d "Cam2" &
wait
exit 0

What goes wrong: the first image is generated, the second imagesnap process hangs -- no image is created and the script never exits.

However, adding a two-second delay causes the problem to go away, and both pictures are taken successfully. This takes 6 seconds instead of 8--the second imagesnap call seems to be starting before the first one ends, but something has happened so that they aren't locking up on each other:

imagesnap -d "Cam1" &
sleep 2
imagesnap -d "Cam2" &
wait
exit 0

Are there any reasons why imagesnap can't be "threaded" or called by multiple jobs at the same time? Note that this is for different cameras, not the same camera being called twice.

We are experiencing this issue on an iMac, 2.16 GHz Intel Core 2 Duo running 10.7.5.

Discussion


Log in to post a comment.