From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 6EBAEE00B6D; Wed, 13 Jan 2016 12:47:28 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (richard.rojfors[at]gmail.com) * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [74.125.82.46 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's * domain * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 27F1EE00B66 for ; Wed, 13 Jan 2016 12:47:25 -0800 (PST) Received: by mail-wm0-f46.google.com with SMTP id f206so391336839wmf.0 for ; Wed, 13 Jan 2016 12:47:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:mime-version :content-transfer-encoding; bh=GX5DaY9E+1iYekG3djVI7CduwalWEpOSD7HHji0rjtQ=; b=0wm9cvjBy3P4/MDJ5OM+Kt5CIyEk4cIGPYkyfkAIDDtEX9o1o4CNYBrxfxafbib9T2 V1qFoKaBWXtfu2qwR8R0mih0XiYX8GowAqBdukuORMWnKSv8fyxoF93BC6/q4RJ4nGk4 AJlgIjhFbjtoLhKIFBtmLVqfNlTI4Jn3hh8jE+6Ooff7ZgfUVXi9UUlZhP59QDp9MeDA 02UGzdA3/Iegdnj4k8hcFzJr3anX2lbXaRcm+p4B+TTIfbEpIPpudZdbh/ptQ/L1z91h nagclssuJ7xGkJOk4qxWpTh8iiMpC1D2QlSaRC1sszYxik34tKp5tZ6f0AA/iZWS9XAO f/xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:date:content-type :mime-version:content-transfer-encoding; bh=GX5DaY9E+1iYekG3djVI7CduwalWEpOSD7HHji0rjtQ=; b=ZbVubLazfRhNYtAF62c9s6Y2VwNW8s9/iS9fYnyB6j2zB9u99sbiY/NIKGAZ8uwFK+ 4bv1p5R8tbPZoNVGWfLGafQ3+r0n0SKA+4nQ7ol6UYtpWDD6I2xWLyWFt79VePQJjLQX RnSNG0Ivxr+Eh1RGfO5fmvzgZbM5IW/4jr4k72LLz3zQvTInC7MuJjDQ+glNQwMuok/A yGh7crn/wVB2koMbrov+sytp/587NwaZOL22z8yhLhs65ri5cAH8H6b3OZy1P0RF4hWq jf4APU97EmfI9BV+ajUouALTGsMLtLnfXWOchV1j2UzMzdetuQ3FZSWSnZiJY6hGgICL LVLA== X-Gm-Message-State: ALoCoQkCRvv8OlgLhIYzYP7SWXS3kyY/v2VgJ3hHGQ4g+ZavdN2Ti/HzGJ3mxaIzrkSwI3pmJ7FveImBYdTTUqbk4M4KEh8szw== X-Received: by 10.28.93.140 with SMTP id r134mr948639wmb.80.1452718044516; Wed, 13 Jan 2016 12:47:24 -0800 (PST) Received: from lillan (h196n19-vrr-a31.ias.bredband.telia.com. [81.230.151.196]) by smtp.gmail.com with ESMTPSA id t9sm3011240wjf.33.2016.01.13.12.47.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jan 2016 12:47:23 -0800 (PST) Message-ID: <1452718041.20224.2.camel@gmail.com> From: Richard =?ISO-8859-1?Q?R=F6jfors?= To: "meta-freescale@yoctoproject.org" Date: Wed, 13 Jan 2016 21:47:21 +0100 X-Mailer: Evolution 3.18.2-0ubuntu1~wily1 Mime-Version: 1.0 Subject: [meta-fsl-arm][PATCH] gal2d-renderer: Avoid deadlock on exit X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2016 20:47:28 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit The way the worker thread was shut down was a bit racy. Make sure to set the flag indicating the thread to stop spinning before waking up the thread. Signed-off-by: Richard Röjfors ---  src/gal2d-renderer.c | 20 ++++++++++----------  1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c index 7ebbf98..d2a29ff 100644 --- a/src/gal2d-renderer.c +++ b/src/gal2d-renderer.c @@ -495,21 +495,21 @@ static void *gal2d_output_worker(void *arg)  {      struct weston_output *output = (struct weston_output *)arg;      struct gal2d_output_state *go = get_output_state(output); +    int go_on = 1;   -    while(1) +    while(go_on)      { -        if(gcoOS_WaitSignal(gcvNULL, go->signal, gcvINFINITE) == gcvSTATUS_OK ) +        int ok = gcoOS_WaitSignal(gcvNULL, go->signal, gcvINFINITE) == gcvSTATUS_OK; + +        pthread_mutex_lock(&go->workerMutex); +        go_on = go->exitWorker == 0; +        pthread_mutex_unlock(&go->workerMutex); + +        if (ok && go_on)          {              gal2d_flip_surface(output);              gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE);          } -        pthread_mutex_lock(&go->workerMutex); -        if(go->exitWorker == 1) -        { -            pthread_mutex_unlock(&go->workerMutex); -            break; -        } -        pthread_mutex_unlock(&go->workerMutex);      }      return 0;  } @@ -1169,10 +1169,10 @@ gal2d_renderer_output_destroy(struct weston_output *output)   }      else      { -        gcoOS_Signal(gcvNULL,go->signal, gcvTRUE);          pthread_mutex_lock(&go->workerMutex);          go->exitWorker = 1;          pthread_mutex_unlock(&go->workerMutex); +        gcoOS_Signal(gcvNULL,go->signal, gcvTRUE);          pthread_join(go->workerId, NULL);      }   -- 2.5.0