From patchwork Mon Sep 17 08:03:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 1465841 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id F2D60DFFFF for ; Mon, 17 Sep 2012 08:03:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754793Ab2IQIDy (ORCPT ); Mon, 17 Sep 2012 04:03:54 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:47690 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754740Ab2IQID2 (ORCPT ); Mon, 17 Sep 2012 04:03:28 -0400 Received: by wgbdr13 with SMTP id dr13so5589699wgb.1 for ; Mon, 17 Sep 2012 01:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=YuN/i5Q0/fJ/j4UMVEvPY7A1XQNQKeQvQ/CmL1NAeGE=; b=eaPHbPTwCLq8NAKPgMd02ouEpz/+e0gezoFwuZkYGJvTEzbP+KFu2w0PjdGL3le/DC /kmHtBlQyVNnXMEwNvnOFpnVCtk1hBdJiPUwHUPJqStRUq9cAUAoEYvrcwfTOK1L415j F9wh3VHfEmbR2W7fAro7yZ2OXlGAPbndCzCmTocr+o4FRCWng3d5Qm3gTqmzJf7IaKaM uBLxuJ82z2Rqz6CPeNWCbbvBbQmFmrwZNtYcMRysk5oHZS0JIT0ra+BRbbCrY0phWmMl NVN1HPQ0xtPqrwlt6vzzAvdKi40E2F/1TiY/1SXyU3l4052/rIeMFwWnmzqQcNKVthnz 8TNw== Received: by 10.216.234.231 with SMTP id s81mr6068769weq.34.1347869006945; Mon, 17 Sep 2012 01:03:26 -0700 (PDT) Received: from localhost.localdomain ([37.46.33.122]) by mx.google.com with ESMTPS id v3sm16632604wiw.7.2012.09.17.01.03.25 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Sep 2012 01:03:26 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: asias.hejun@gmail.com, mingo@elte.hu, gorcunov@openvz.org, kvm@vger.kernel.org, Sasha Levin Subject: [PATCH 5/8] kvm tools: initialize the threadpool job iterator before using Date: Mon, 17 Sep 2012 10:03:33 +0200 Message-Id: <1347869016-17204-5-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1347869016-17204-1-git-send-email-levinsasha928@gmail.com> References: <1347869016-17204-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This would fix a bug where the exit function of the threadpool would hang if no jobs were processed yet and a request to exit was received. Signed-off-by: Sasha Levin --- tools/kvm/util/threadpool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kvm/util/threadpool.c b/tools/kvm/util/threadpool.c index 24e2344..85ac7e7 100644 --- a/tools/kvm/util/threadpool.c +++ b/tools/kvm/util/threadpool.c @@ -79,7 +79,7 @@ static void *thread_pool__threadfunc(void *param) pthread_cleanup_push(thread_pool__threadfunc_cleanup, NULL); while (running) { - struct thread_pool__job *curjob; + struct thread_pool__job *curjob = NULL; mutex_lock(&job_mutex); while (running && (curjob = thread_pool__job_pop_locked()) == NULL)