Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148172049
D11270.1785645415.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
877 B
Referenced Files
None
Subscribers
None
D11270.1785645415.diff
View Options
Index: head/sys/sys/refcount.h
===================================================================
--- head/sys/sys/refcount.h
+++ head/sys/sys/refcount.h
@@ -50,7 +50,7 @@
{
KASSERT(*count < UINT_MAX, ("refcount %p overflowed", count));
- atomic_add_acq_int(count, 1);
+ atomic_add_int(count, 1);
}
static __inline int
@@ -58,10 +58,20 @@
{
u_int old;
- /* XXX: Should this have a rel membar? */
+ atomic_thread_fence_rel();
old = atomic_fetchadd_int(count, -1);
KASSERT(old > 0, ("negative refcount %p", count));
- return (old == 1);
+ if (old > 1)
+ return (0);
+
+ /*
+ * Last reference. Signal the user to call the destructor.
+ *
+ * Ensure that the destructor sees all updates. The fence_rel
+ * at the start of the function synchronized with this fence.
+ */
+ atomic_thread_fence_acq();
+ return (1);
}
#endif /* ! __SYS_REFCOUNT_H__ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 2, 4:36 AM (15 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29333002
Default Alt Text
D11270.1785645415.diff (877 B)
Attached To
Mode
D11270: Correct fences for sys/refcount.h
Attached
Detach File
Event Timeline
Log In to Comment