OSDN Git Service

rcu: Add automatically released rcu_read_lock variants
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Mon, 7 Oct 2019 14:36:37 +0000 (15:36 +0100)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Fri, 11 Oct 2019 13:19:49 +0000 (14:19 +0100)
commit5626f8c6d46832b02ce4fdc0bd109516bc812043
tree1f5ebde7290eb695f62e050a047168cc5c745feb
parent8f8d528e73144c063deafc534df0a04c67f6f98e
rcu: Add automatically released rcu_read_lock variants

RCU_READ_LOCK_GUARD() takes the rcu_read_lock and then uses glib's
g_auto infrastructure (and thus whatever the compiler's hooks are) to
release it on all exits of the block.

WITH_RCU_READ_LOCK_GUARD() is similar but is used as a wrapper for the
lock, i.e.:

   WITH_RCU_READ_LOCK_GUARD() {
       stuff under lock
   }

Note the 'unused' attribute is needed to work around clang bug:
  https://bugs.llvm.org/show_bug.cgi?id=43482

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20191007143642.301445-2-dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
docs/devel/rcu.txt
include/qemu/rcu.h