[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: 8/25: Concurrent dispatch of RPC methods



On Thu, Jan 15, 2009 at 05:07:01PM +0000, Richard W.M. Jones wrote:
> On Tue, Jan 13, 2009 at 05:41:48PM +0000, Daniel P. Berrange wrote:
> > +    /* Get a unique serial number for this message. */
> > +    rv->serial = priv->counter++;
> 
> This (and similar) are safe because we hold the remoteDriverLock until
> we enter the actual call?

That is correct - the first thing all the public API entry points do
is grab the lock. 

The lock is only then released, when the main thread is waiting on I/O
in the poll() call:

+        remoteDriverUnlock(priv);
+            
+    repoll:
+        ret = poll(fds, ARRAY_CARDINALITY(fds), -1);
+        if (ret < 0 && errno == EINTR)
+            goto repoll;
+        remoteDriverLock(priv);


Or when additional threads are sleeping on the condition variable.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]