[Spice-devel] [RFC] server: add main_dispatcher
Gerd Hoffmann
kraxel at redhat.com
Thu Sep 8 00:31:33 PDT 2011
Hi,
>> simple object system, not unions). Just an idea, could be changed
>> later perhaps. socketpair is probably fine.
>
> First of all I see I forgot to add a mutex, since I said "any non main thread", right
> now we only have one, so no need to lock, but the idea is that it can also be called from
> others, and so we will need it later. (unless that write can be considered atomic, but
> I don't think it can)
A single write system call is atomic.
> To answer your question - infrequently. So I don't want / think we need to invest in
> optimizing this. Right now the only usage is the channel event (core->channel_event)
> calls, which have to happen in the main thread, and are currently done also from the
> worker thread.
>
> Thanks for the reference, I'll definitely check it. We already use a single socketpair
> btw in red_dispatcher, this is a simple copy from there, I didn't actually create a
> base "dispatcher" class because there are some differences and there isn't that much
> shared code
It makes sense to use the same mechanism everythere in spice.
We might want to look out for something else, I guess the pipe /
socketpair isn't exactly the most efficient way to do inter-thread
communication. But I don't think that is a bottle-neck in spice, there
isn't that much communication going on between red_dispatcher and
red_worker.
cheers,
Gerd
More information about the Spice-devel
mailing list