You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2015/02/13 22:46:03 UTC
[13/16] lucy-clownfish git commit: Fix race on fetching refcount.
Fix race on fetching refcount.
It's very unlikely, but possible that a host object could get cached by
another thread in between the check and the usage.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/afde943d
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/afde943d
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/afde943d
Branch: refs/heads/master
Commit: afde943d975456cd473e18732c0b620b4d86c082
Parents: 52b1f98
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sun Feb 8 21:04:36 2015 -0800
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sun Feb 8 21:04:36 2015 -0800
----------------------------------------------------------------------
runtime/perl/xs/XSBind.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/afde943d/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c
index d29d1ec..ae5591a 100644
--- a/runtime/perl/xs/XSBind.c
+++ b/runtime/perl/xs/XSBind.c
@@ -673,9 +673,10 @@ S_lazy_init_host_obj(cfish_Obj *self) {
uint32_t
cfish_get_refcount(void *vself) {
cfish_Obj *self = (cfish_Obj*)vself;
- return self->ref.count & XSBIND_REFCOUNT_FLAG
- ? self->ref.count >> XSBIND_REFCOUNT_SHIFT
- : SvREFCNT((SV*)self->ref.host_obj);
+ cfish_ref_t ref = self->ref;
+ return ref.count & XSBIND_REFCOUNT_FLAG
+ ? ref.count >> XSBIND_REFCOUNT_SHIFT
+ : SvREFCNT((SV*)ref.host_obj);
}
cfish_Obj*