Is it possible to prioritise a lock? : <p>I have a <code>multiprocessing</code> program where</p>

<ul>
<li>one process adds elements to a shared list (<code>multiprocessing.Manager().list()</code>)</li>
<li>several other processes consume these elements from that list (and remove them); they run until there is something to process in the list and the process above is still adding to the list.</li>
</ul>

<p>I implemented locking (via <code>multiprocessing.Lock()</code>) when adding to the list, or removing from it. Since there is one "feeder" process and several (10-40) "consumer" ones all competing for the lock, and that the consumer processes are fast, I end up with the "feeder" process having a hard time acquiring the lock.</p>

<p><strong>Is there a concept of "priority" when acquiring a lock?</strong> I would like the "feeder" process to acquire it with more priority than the others.</p>

<p>Right now I mitigated the issue by having the "consumer" processes wait a random time before trying to acquire the lock while the "feeder" process is there (when it ends it sets a flag). This is a workaround which works but it is ugly and  hardly effective (I have the processes wait <code>random.random()*n</code> seconds, where <code>n</code> is the number of processes. This is a completely made up number, probably wrong). </p>
