|
From: | Paolo Bonzini |
Subject: | [Qemu-devel] Re: [PATCH 1/3] Introduce threadlets |
Date: | Fri, 15 Oct 2010 16:42:27 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3 |
On 10/14/2010 11:02 AM, Stefan Hajnoczi wrote:
2. Moving qemu_cond_signal() outside queue->lock is dangerous for the same reason: you need to be careful not to qemu_cond_signal() when the thread isn't inside qemu_cond_timedwait()."
Yes, please do so.I personally consider it bad programming practice to put the condvar signal/broadcast outside the mutex. While I understand that my ideas may not matter much, some Mr. Hoare actually invented them without signal-outside-lock, and he probably knows better than anyone reading.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |