On Sun, Mar 03, 2013 at 09:21:22PM +0800, Liu Ping Fan wrote: > diff --git a/net/hub.c b/net/hub.c > index 97c3ac3..ab4448e 100644 > --- a/net/hub.c > +++ b/net/hub.c > @@ -36,6 +36,7 @@ typedef struct NetHubPort { > } NetHubPort; > > struct NetHub { > + QemuMutex lock;
Please document what this lock protects. I think it only protects the ports list. > diff --git a/net/net.c b/net/net.c > index 0acb933..5a8bb6a 100644 > --- a/net/net.c > +++ b/net/net.c > @@ -45,6 +45,7 @@ > # define CONFIG_NET_BRIDGE > #endif > > +static QemuMutex net_clients_lock; > static QTAILQ_HEAD(, NetClientState) net_clients; I'm not sure what net_clients_lock protects since this lock is not taken by all net_clients users. The lock should be destroyed in net_cleanup(). This should be a separate patch that fully explains the purpose of the lock and uses it consistently in net.c.