Improve the comment of util/thread_local.h
Summary: Improve the comment of util/thread_local.h Test Plan: n/a Reviewers: ljin Reviewed By: ljin Differential Revision: https://reviews.facebook.net/D25449
This commit is contained in:
parent
6398e6a6a5
commit
e11a5e776f
@ -26,13 +26,14 @@ namespace rocksdb {
|
||||
// (2) a ThreadLocalPtr is destroyed
|
||||
typedef void (*UnrefHandler)(void* ptr);
|
||||
|
||||
// Thread local storage that only stores value of pointer type. The storage
|
||||
// distinguish data coming from different thread and different ThreadLocalPtr
|
||||
// instances. For example, if a regular thread_local variable A is declared
|
||||
// in DBImpl, two DBImpl objects would share the same A. ThreadLocalPtr avoids
|
||||
// the confliction. The total storage size equals to # of threads * # of
|
||||
// ThreadLocalPtr instances. It is not efficient in terms of space, but it
|
||||
// should serve most of our use cases well and keep code simple.
|
||||
// ThreadLocalPtr stores only values of pointer type. Different from
|
||||
// the usual thread-local-storage, ThreadLocalPtr has the ability to
|
||||
// distinguish data coming from different threads and different
|
||||
// ThreadLocalPtr instances. For example, if a regular thread_local
|
||||
// variable A is declared in DBImpl, two DBImpl objects would share
|
||||
// the same A. However, a ThreadLocalPtr that is defined under the
|
||||
// scope of DBImpl can avoid such confliction. As a result, its memory
|
||||
// usage would be O(# of threads * # of ThreadLocalPtr instances).
|
||||
class ThreadLocalPtr {
|
||||
public:
|
||||
explicit ThreadLocalPtr(UnrefHandler handler = nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user