Add a comment to WeakPtr.h which explicitly calls out the fact that it's not thread-safe, no bug, DONTBUILD
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 28 Mar 2014 00:12:30 -0400
changeset 175833 7d5848e153010a645c109343cf57cd118c4e078b
parent 175832 d9e6a6c40a57393d318e236558f799481cf7074f
child 175834 fabc466d8703e563a0044661b23c67c9f6ad6103
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone31.0a1
Add a comment to WeakPtr.h which explicitly calls out the fact that it's not thread-safe, no bug, DONTBUILD
mfbt/WeakPtr.h
--- a/mfbt/WeakPtr.h
+++ b/mfbt/WeakPtr.h
@@ -9,16 +9,18 @@
 /**
  * SupportsWeakPtr lets you have a pointer to an object 'Foo' without affecting
  * its lifetime. It works by creating a single shared reference counted object
  * (WeakReference) that each WeakPtr will access 'Foo' through. This lets 'Foo'
  * clear the pointer in the WeakReference without having to know about all of
  * the WeakPtrs to it and allows the WeakReference to live beyond the lifetime
  * of 'Foo'.
  *
+ * PLEASE NOTE: This weak pointer implementation is not thread-safe.
+ *
  * Note that when deriving from SupportsWeakPtr you should add
  * MOZ_DECLARE_REFCOUNTED_TYPENAME(ClassName) to the public section of your
  * class, where ClassName is the name of your class.
  *
  * The overhead of WeakPtr is that accesses to 'Foo' becomes an additional
  * dereference, and an additional heap allocated pointer sized object shared
  * between all of the WeakPtrs.
  *