Skip to content

Commit

Permalink
[tls] Remove support for pthread tls (#31040)
Browse files Browse the repository at this point in the history
* [tls] Remove support for pthread tls

* fix

* fix

* fix

* lalala

* fix

* fix

* Clean up deployment target changes

* additional clean up of deployment target

* regen podspec for updated file list

* remove destination change

* deployment target override for ios cpp test

* fix?

* fix run test script & update test destination

* [tls] Remove support for pthread tls

* fix

* fix

* fix

* lalala

* fix

* fix

* Clean up deployment target changes

* additional clean up of deployment target

* regen podspec for updated file list

* remove destination change

* deployment target override for ios cpp test

* fix?

* fix run test script & update test destination

* merge

* fix

* final script fix for proper destination & target

* more deployment target fix

* objc ios test script fix

Co-authored-by: Denny C. Dai <dennycd@me.com>
Co-authored-by: dennycd <dennycd@google.com>
  • Loading branch information
3 people committed Sep 23, 2022
1 parent c3714ec commit f15ba1f
Show file tree
Hide file tree
Showing 36 changed files with 65 additions and 395 deletions.
19 changes: 1 addition & 18 deletions BUILD
Expand Up @@ -1122,19 +1122,12 @@ grpc_cc_library(
"env",
"examine_stack",
"gpr_atm",
"gpr_tls",
"no_destruct",
"tchar",
"useful",
],
)

grpc_cc_library(
name = "gpr_tls",
hdrs = ["src/core/lib/gpr/tls.h"],
deps = ["gpr_platform"],
)

grpc_cc_library(
name = "chunked_vector",
hdrs = ["src/core/lib/gprpp/chunked_vector.h"],
Expand Down Expand Up @@ -1394,10 +1387,7 @@ grpc_cc_library(
public_hdrs = [
"src/core/lib/promise/context.h",
],
deps = [
"gpr_platform",
"gpr_tls",
],
deps = ["gpr_platform"],
)

grpc_cc_library(
Expand Down Expand Up @@ -1675,7 +1665,6 @@ grpc_cc_library(
"construct_destruct",
"context",
"gpr",
"gpr_tls",
"no_destruct",
"orphanable",
"poll",
Expand Down Expand Up @@ -2223,7 +2212,6 @@ grpc_cc_library(
deps = [
"event_engine_base_hdrs",
"gpr",
"gpr_tls",
"no_destruct",
"useful",
],
Expand All @@ -2250,7 +2238,6 @@ grpc_cc_library(
"gpr",
"gpr_atm",
"gpr_spinlock",
"gpr_tls",
"grpc_codegen",
"grpc_trace",
"time",
Expand Down Expand Up @@ -2320,7 +2307,6 @@ grpc_cc_library(
"gpr_manual_constructor",
"gpr_platform",
"gpr_spinlock",
"gpr_tls",
"grpc_trace",
"iomgr_port",
"time",
Expand Down Expand Up @@ -2505,7 +2491,6 @@ grpc_cc_library(
deps = [
"forkable",
"gpr",
"gpr_tls",
],
)

Expand All @@ -2525,7 +2510,6 @@ grpc_cc_library(
"event_engine_base_hdrs",
"forkable",
"gpr",
"gpr_tls",
"grpc_trace",
"posix_event_engine_timer",
"time",
Expand Down Expand Up @@ -3395,7 +3379,6 @@ grpc_cc_library(
"gpr_manual_constructor",
"gpr_murmur_hash",
"gpr_spinlock",
"gpr_tls",
"grpc_public_hdrs",
"grpc_sockaddr",
"grpc_trace",
Expand Down
36 changes: 0 additions & 36 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions build_autogenerated.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions gRPC-C++.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions gRPC-Core.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion grpc.gemspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions include/grpc/impl/codegen/port_platform.h
Expand Up @@ -234,9 +234,6 @@
#define GPR_CPU_POSIX 1
#define GPR_POSIX_CRASH_HANDLER 1
#endif
#if !(defined(__has_feature) && __has_feature(cxx_thread_local))
#define GPR_PTHREAD_TLS 1
#endif
#define GPR_APPLE 1
#define GPR_GCC_ATOMIC 1
#define GPR_POSIX_LOG 1
Expand Down
1 change: 0 additions & 1 deletion package.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/core/ext/transport/binder/utils/ndk_binder.cc
Expand Up @@ -24,7 +24,6 @@

#include <grpc/support/log.h>

#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gprpp/sync.h"

namespace {
Expand All @@ -46,7 +45,7 @@ grpc_core::Mutex g_jvm_mu;

// Whether the thread has already attached to JVM (this is to prevent
// repeated attachment in `AttachJvm()`)
GPR_THREAD_LOCAL(bool) g_is_jvm_attached = false;
thread_local bool g_is_jvm_attached = false;

void SetJvm(JNIEnv* env) {
// OK to lock here since this function will only be called once for each
Expand Down
3 changes: 1 addition & 2 deletions src/core/lib/event_engine/posix_engine/timer_manager.cc
Expand Up @@ -33,10 +33,9 @@
#include <grpc/support/time.h>

#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gprpp/thd.h"

static GPR_THREAD_LOCAL(bool) g_timer_thread;
static thread_local bool g_timer_thread;

namespace grpc_event_engine {
namespace posix_engine {
Expand Down
3 changes: 1 addition & 2 deletions src/core/lib/event_engine/thread_pool.cc
Expand Up @@ -28,7 +28,6 @@

#include <grpc/support/log.h>

#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gprpp/thd.h"

namespace grpc_event_engine {
Expand All @@ -37,7 +36,7 @@ namespace experimental {
namespace {
// TODO(drfloob): Remove this, and replace it with the WorkQueue* for the
// current thread (with nullptr indicating not a threadpool thread).
GPR_THREAD_LOCAL(bool) g_threadpool_thread;
thread_local bool g_threadpool_thread;
} // namespace

void ThreadPool::StartThread(StatePtr state, bool throttled) {
Expand Down
3 changes: 1 addition & 2 deletions src/core/lib/gpr/log_linux.cc
Expand Up @@ -44,7 +44,6 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>

#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gprpp/examine_stack.h"

int gpr_should_log_stacktrace(gpr_log_severity severity);
Expand Down Expand Up @@ -77,7 +76,7 @@ void gpr_default_log(gpr_log_func_args* args) {
time_t timer;
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
struct tm tm;
static GPR_THREAD_LOCAL(long) tid(0);
static thread_local long tid(0);
if (tid == 0) tid = sys_gettid();

timer = static_cast<time_t>(now.tv_sec);
Expand Down

0 comments on commit f15ba1f

Please sign in to comment.