biometrics/openbr — pull request #79 by caotto (2013-07-30 00:41:48+00:00)
Title: A way to avoid deadlocks when using stream inside a distribute transform

This pull request implements a scheme to avoid a deadlock that would occur when using multiple streams simultaneously (via a distribute transform). The deadlock is caused by 1. distribute making time-varying transforms like stream a limited resource, and 2. the indefinite wait in stream::projectUpdate releasing a thread (which it needs to process a video), which would then immediately be taken by a distribute job, which would then deadlock waiting for a stream to become available.

This pull request avoids that deadlock by doing the release/reserve in stream::projectUpdate more carefully, and also by starting distribute jobs with a lower priority than stream jobs. The second change (commit 50752fe) has some negative consequences as discussed in that commit message.