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

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to