Docs for SingletonThreadLocal
authorPhil Willoughby <philwill@fb.com>
Thu, 1 Jun 2017 15:43:35 +0000 (08:43 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 1 Jun 2017 15:51:42 +0000 (08:51 -0700)
Summary:
Add a few keywords people search for when looking for this that won't otherwise
find this file.

Add a reference to the usage notes for Singleton which are a good description
of how you should operate SingletoThreadLocal as well.

Reviewed By: nbronson

Differential Revision: D5094598

fbshipit-source-id: 9980850805e1564e5c394af713e2fa17fe8844fe

folly/SingletonThreadLocal.h

index 943883b6f5931bfabff544fcb555534e7a6cfb39..a4bb462735c92de527cccf96ce670fe5a765a58e 100644 (file)
 
 namespace folly {
 
+// SingletonThreadLocal
+//
+// This class can help you implement a per-thread leaky-singleton model within
+// your application. Please read the usage block at the top of Singleton.h as
+// the recommendations there are also generally applicable to this class.
+//
+// When we say this is "leaky" we mean that the T instances held by a
+// SingletonThreadLocal<T> will survive until their owning thread exits,
+// regardless of the lifetime of the singleton object holding them.  That
+// means that they can be safely used during process shutdown, and
+// that they can also be safely used in an application that spawns many
+// temporary threads throughout its life.
+//
+// Keywords to help people find this class in search:
+// Thread Local Singleton ThreadLocalSingleton
 template <typename T, typename Tag = detail::DefaultTag>
 class SingletonThreadLocal {
  public: