On Thu, Sep 08, 2011 at 09:31:33AM +0200, Gerd Hoffmann wrote: > 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.
ok, I'll add a comment to this effect. > > >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. Is this a vote for creating a base/shared struct? but then we have the existing send+ack behavior that can't be copied because of the mentioned deadlock, so either I make it so it can be used in both ways, i.e. messaging is left for the user, or what, check for deadlocks? > > 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. > So - I was going to send this patch as a PATCH and to 0.8 as well (I have it ready, tested) - is further work required? do you want to try to create a base class? > cheers, > Gerd > > _______________________________________________ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/spice-devel _______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel