/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#pragma once
#include <limits.h>
-#include <pthread.h>
#include <atomic>
#include <functional>
#include <folly/MicroSpinLock.h>
#include <folly/Portability.h>
#include <folly/ScopeGuard.h>
+#include <folly/SharedMutex.h>
+#include <folly/portability/PThread.h>
#include <folly/detail/StaticSingletonManager.h>
#endif
namespace folly {
+
+enum class TLPDestructionMode { THIS_THREAD, ALL_THREADS };
+struct AccessModeStrict {};
+
namespace threadlocal_detail {
/**
StaticMetaBase(ThreadEntry* (*threadEntry)(), bool strict);
- ~StaticMetaBase() {
- LOG(FATAL) << "StaticMeta lives forever!";
+ [[noreturn]] ~StaticMetaBase() {
+ folly::assume_unreachable();
}
void push_back(ThreadEntry* t) {
static StaticMeta<Tag, AccessMode>& instance() {
// Leak it on exit, there's only one per process and we don't have to
// worry about synchronization with exiting threads.
- static auto instance =
+ /* library-local */ static auto instance =
detail::createGlobal<StaticMeta<Tag, AccessMode>, void>();
return *instance;
}
}
};
-} // namespace threadlocal_detail
-} // namespace folly
+} // namespace threadlocal_detail
+} // namespace folly