From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsW8E-0004Wq-K0 for qemu-devel@nongnu.org; Fri, 28 Jun 2013 06:42:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsW8C-0006Zh-47 for qemu-devel@nongnu.org; Fri, 28 Jun 2013 06:42:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsW8B-0006Zd-Sh for qemu-devel@nongnu.org; Fri, 28 Jun 2013 06:42:20 -0400 Message-ID: <51CD6914.5060601@redhat.com> Date: Fri, 28 Jun 2013 12:44:36 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 06/10] qemu-ga: Add Windows VSS provider to quiesce applications on fsfreeze List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tomoki Sekiyama Cc: "libaiqing@huawei.com" , "mdroth@linux.vnet.ibm.com" , "stefanha@gmail.com" , "qemu-devel@nongnu.org" , "lcapitulino@redhat.com" , "vrozenfe@redhat.com" , "pbonzini@redhat.com" , Seiji Aguchi , "areis@redhat.com" >>>>> +STDAPI DllCanUnloadNow() >>>>> +{ >>>>> + return g_nComObjsInUse == 0 ? S_OK : S_FALSE; >>>>> +} >> >> Don't you need some kind of atomic or locked read here? We could read a >> stale value here. Granted, most stale values would err on the safe side >> (ie. read >0 instead of ==0), but in theory the other mistake is >> possible, no? > > MSDN says "Simple reads and writes to properly-aligned 32bit variables > are atomic", and I couldn't find a function to atomic read provided. > (Maybe InterlockedCompareExchange(&g_nComObjsInUse, 0, 0)...?) Alright then. Thanks! Laszlo