[Spice-devel] [PATCH spice-gtk 01/10] spice-channel: Allow spice_msg_out_send to be called from multiple threads
Hans de Goede
hdegoede at redhat.com
Sat Dec 24 00:23:15 PST 2011
First of all thanks for the review of this series!
On 12/23/2011 06:10 PM, Christophe Fergeau wrote:
> On Mon, Dec 19, 2011 at 12:24:34PM +0100, Hans de Goede wrote:
>> This is a preparation patch for handling usb packet completion in a
>> separate thread.
> I haven't looked at the patches extending this, but I have 2 comments
> * the xmit_queue_lock + xmit_queue combination looks a lot like GAsyncQueue
You may be right there, but I also need a lock to protect the variable
which protects the queue from new messages been queued by the usb event handling
thread after disconnect (and the queue has been cleared). Right now I can
use the same lock for this, so sticking with the current code seems best.
> * using both coroutine and threads to send messages sounds scary...
The thread is only handling usb packet completion callbacks, it is not doing
any sending itself. All network io is handled from the co-routine. But the
thread may want to queue new messages to be send, which means that
spice_msg_out_send needs to allow for multiple simultaneous callers.
IOW the only interaction between the thread and the rest of spice-gtk
is the queuing of SpiceMsgOut messages, which is relatively simple and as
such should be quite safe.
> Apart from this, the patch looks good.
Can I consider that an ack?
More information about the Spice-devel