Skip to content

Commit

Permalink
check functions for ThreadLocalPtr::get, ThreadLocal::get
Browse files Browse the repository at this point in the history
Differential Revision: D58831186

fbshipit-source-id: 71f8e3670ddc9f01a59d659bdd4c68e72d647ef6
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jun 21, 2024
1 parent 9a14b30 commit d0bdf42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions folly/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -1721,6 +1721,7 @@ cpp_binary(
"//folly:benchmark",
"//folly:thread_local",
"//folly/experimental/io:fs_util",
"//folly/lang:keep",
"//folly/portability:gflags",
],
external_deps = [
Expand Down
10 changes: 10 additions & 0 deletions folly/test/ThreadLocalBenchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,20 @@

#include <folly/Benchmark.h>
#include <folly/experimental/io/FsUtil.h>
#include <folly/lang/Keep.h>
#include <folly/portability/GFlags.h>

using namespace folly;

extern "C" FOLLY_KEEP int* check_folly_thread_local_ptr_get(
ThreadLocalPtr<int>* tlp) {
return tlp->get();
}

extern "C" FOLLY_KEEP int* check_folly_thread_local_get(ThreadLocal<int>* tl) {
return tl->get();
}

// Simple reference implementation using pthread_get_specific
template <typename T>
class PThreadGetSpecific {
Expand Down

0 comments on commit d0bdf42

Please sign in to comment.