From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuHoT-0001G9-Up for qemu-devel@nongnu.org; Wed, 03 Jul 2013 03:49:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UuHoP-0002y0-Qq for qemu-devel@nongnu.org; Wed, 03 Jul 2013 03:49:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuHoP-0002xh-Gx for qemu-devel@nongnu.org; Wed, 03 Jul 2013 03:49:13 -0400 Date: Wed, 3 Jul 2013 09:49:08 +0200 From: Stefan Hajnoczi Message-ID: <20130703074908.GA16585@stefanha-thinkpad.muc.redhat.com> References: <1371114186-8854-1-git-send-email-qemulist@gmail.com> <1371114186-8854-4-git-send-email-qemulist@gmail.com> <20130618124133.GJ7649@stefanha-thinkpad.redhat.com> <20130701115057.GC5543@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v2 3/6] net: make netclient re-entrant with refcnt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, mdroth On Wed, Jul 03, 2013 at 11:41:19AM +0800, liu ping fan wrote: > On Mon, Jul 1, 2013 at 7:50 PM, Stefan Hajnoczi wrote: > > On Thu, Jun 20, 2013 at 05:14:56PM +0800, liu ping fan wrote: > >> On Tue, Jun 18, 2013 at 8:41 PM, Stefan Hajnoczi wrote: > >> > On Thu, Jun 13, 2013 at 05:03:03PM +0800, Liu Ping Fan wrote: > >> >> @@ -1109,6 +1146,7 @@ void net_cleanup(void) > >> >> qemu_del_net_client(nc); > >> >> } > >> >> } > >> >> + qemu_mutex_destroy(&net_clients_lock); > >> > > >> > Why is it okay to iterate over net_clients here without the lock? > >> > >> atexit(&net_cleanup); So no other racers exist. > > > > What about dataplane? The device may not be reset when net_cleanup runs. > > > Does the func registered by atexit run after all of the other threads terminate? I imagine that atexit(3) runs while detached threads are still alive, but I'm not sure about the exact rules. The pthread specification links I found online didn't state the rules. Stefan