[Spice-devel] [PATCH] dcc: do not cause problem with multiple threads.
Frediano Ziglio
fziglio at redhat.com
Fri Dec 11 07:05:54 PST 2015
>
> On Fri, Dec 11, 2015 at 08:46:15AM -0600, Jonathon Jongsma wrote:
> > On Thu, 2015-12-10 at 20:13 +0000, Frediano Ziglio wrote:
> > > With multiple cards configured you can have multiple workers running in
> > > different thread.
> > > With such configuration static variables not syncronized could lead
> > > to undefined behavior.
> > > ---
> > > server/dcc-send.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/server/dcc-send.c b/server/dcc-send.c
> > > index 30303e7..c29fd8c 100644
> > > --- a/server/dcc-send.c
> > > +++ b/server/dcc-send.c
> > > @@ -683,8 +683,8 @@ static void
> > > red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient
> > > SpiceRect
> > > *first_area)
> > > {
> > > /* TODO: can't have those statics with multiple clients */
> > > - static int resent_surface_ids[MAX_PIPE_SIZE];
> > > - static SpiceRect resent_areas[MAX_PIPE_SIZE]; // not pointers since
> > > drawbales may be released
> > > + int resent_surface_ids[MAX_PIPE_SIZE];
> > > + SpiceRect resent_areas[MAX_PIPE_SIZE]; // not pointers since
> > > drawbales
> > > may be released
> > > int num_resent;
> > > PipeItem *pipe_item;
> > > Ring *pipe;
> >
> >
> > I can't figure out why those variables would have been defined static in
> > the
> > first place... The patch looks correct to me. Perhaps you could fix the
> > comment
> > typo at the same time though: drawbales -> drawables
>
> And remove the TODO comment too.
>
> Christophe
>
Done both
Frediano
More information about the Spice-devel
mailing list