Skip to content

Commit

Permalink
Privatize thread-local storage headers
Browse files Browse the repository at this point in the history
  • Loading branch information
vjpai committed Jan 26, 2018
1 parent e0adbb6 commit b6cf123
Show file tree
Hide file tree
Showing 31 changed files with 77 additions and 108 deletions.
8 changes: 4 additions & 4 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ GPR_PUBLIC_HDRS = [
"include/grpc/support/sync_windows.h",
"include/grpc/support/thd.h",
"include/grpc/support/time.h",
"include/grpc/support/tls.h",
"include/grpc/support/tls_gcc.h",
"include/grpc/support/tls_msvc.h",
"include/grpc/support/tls_pthread.h",
"include/grpc/support/useful.h",
]

Expand Down Expand Up @@ -509,6 +505,10 @@ grpc_cc_library(
"src/core/lib/gpr/string_windows.h",
"src/core/lib/gpr/thd_internal.h",
"src/core/lib/gpr/time_precise.h",
"src/core/lib/gpr/tls.h",
"src/core/lib/gpr/tls_gcc.h",
"src/core/lib/gpr/tls_msvc.h",
"src/core/lib/gpr/tls_pthread.h",
"src/core/lib/gpr/tmpfile.h",
],
language = "c++",
Expand Down
16 changes: 0 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -719,10 +719,6 @@ foreach(_hdr
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/support/tls.h
include/grpc/support/tls_gcc.h
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
Expand Down Expand Up @@ -2513,10 +2509,6 @@ foreach(_hdr
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/support/tls.h
include/grpc/support/tls_gcc.h
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
Expand Down Expand Up @@ -2997,10 +2989,6 @@ foreach(_hdr
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/support/tls.h
include/grpc/support/tls_gcc.h
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
Expand Down Expand Up @@ -3727,10 +3715,6 @@ foreach(_hdr
include/grpc/support/sync_windows.h
include/grpc/support/thd.h
include/grpc/support/time.h
include/grpc/support/tls.h
include/grpc/support/tls_gcc.h
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
Expand Down
16 changes: 0 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2912,10 +2912,6 @@ PUBLIC_HEADERS_C += \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/support/tls.h \
include/grpc/support/tls_gcc.h \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
Expand Down Expand Up @@ -4644,10 +4640,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/support/tls.h \
include/grpc/support/tls_gcc.h \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
Expand Down Expand Up @@ -5133,10 +5125,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/support/tls.h \
include/grpc/support/tls_gcc.h \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
Expand Down Expand Up @@ -5852,10 +5840,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/sync_windows.h \
include/grpc/support/thd.h \
include/grpc/support/time.h \
include/grpc/support/tls.h \
include/grpc/support/tls_gcc.h \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
Expand Down
8 changes: 4 additions & 4 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ filegroups:
- include/grpc/support/sync_windows.h
- include/grpc/support/thd.h
- include/grpc/support/time.h
- include/grpc/support/tls.h
- include/grpc/support/tls_gcc.h
- include/grpc/support/tls_msvc.h
- include/grpc/support/tls_pthread.h
- include/grpc/support/useful.h
headers:
- src/core/lib/gpr/arena.h
Expand All @@ -111,6 +107,10 @@ filegroups:
- src/core/lib/gpr/string_windows.h
- src/core/lib/gpr/thd_internal.h
- src/core/lib/gpr/time_precise.h
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tls_gcc.h
- src/core/lib/gpr/tls_msvc.h
- src/core/lib/gpr/tls_pthread.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gprpp/abstract.h
- src/core/lib/gprpp/atomic.h
Expand Down
8 changes: 8 additions & 0 deletions gRPC-C++.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
Expand Down Expand Up @@ -458,6 +462,10 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
Expand Down
12 changes: 8 additions & 4 deletions gRPC-Core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ Pod::Spec.new do |s|
'include/grpc/support/sync_windows.h',
'include/grpc/support/thd.h',
'include/grpc/support/time.h',
'include/grpc/support/tls.h',
'include/grpc/support/tls_gcc.h',
'include/grpc/support/tls_msvc.h',
'include/grpc/support/tls_pthread.h',
'include/grpc/support/useful.h',
'include/grpc/impl/codegen/atm.h',
'include/grpc/impl/codegen/atm_gcc_atomic.h',
Expand Down Expand Up @@ -203,6 +199,10 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
Expand Down Expand Up @@ -732,6 +732,10 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/thd_internal.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
Expand Down
8 changes: 4 additions & 4 deletions grpc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/support/sync_windows.h )
s.files += %w( include/grpc/support/thd.h )
s.files += %w( include/grpc/support/time.h )
s.files += %w( include/grpc/support/tls.h )
s.files += %w( include/grpc/support/tls_gcc.h )
s.files += %w( include/grpc/support/tls_msvc.h )
s.files += %w( include/grpc/support/tls_pthread.h )
s.files += %w( include/grpc/support/useful.h )
s.files += %w( include/grpc/impl/codegen/atm.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
Expand All @@ -93,6 +89,10 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/string_windows.h )
s.files += %w( src/core/lib/gpr/thd_internal.h )
s.files += %w( src/core/lib/gpr/time_precise.h )
s.files += %w( src/core/lib/gpr/tls.h )
s.files += %w( src/core/lib/gpr/tls_gcc.h )
s.files += %w( src/core/lib/gpr/tls_msvc.h )
s.files += %w( src/core/lib/gpr/tls_pthread.h )
s.files += %w( src/core/lib/gpr/tmpfile.h )
s.files += %w( src/core/lib/gprpp/abstract.h )
s.files += %w( src/core/lib/gprpp/atomic.h )
Expand Down
4 changes: 0 additions & 4 deletions include/grpc/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ framework module grpc {
header "support/sync_generic.h"
header "support/thd.h"
header "support/time.h"
header "support/tls.h"
header "support/useful.h"
header "impl/codegen/atm.h"
header "impl/codegen/fork.h"
Expand Down Expand Up @@ -63,9 +62,6 @@ framework module grpc {
textual header "support/sync_custom.h"
textual header "support/sync_posix.h"
textual header "support/sync_windows.h"
textual header "support/tls_gcc.h"
textual header "support/tls_msvc.h"
textual header "support/tls_pthread.h"
textual header "impl/codegen/atm_gcc_atomic.h"
textual header "impl/codegen/atm_gcc_sync.h"
textual header "impl/codegen/atm_windows.h"
Expand Down
8 changes: 4 additions & 4 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@
<file baseinstalldir="/" name="include/grpc/support/sync_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/thd.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/time.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls_gcc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls_msvc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls_pthread.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/useful.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_atomic.h" role="src" />
Expand All @@ -100,6 +96,10 @@
<file baseinstalldir="/" name="src/core/lib/gpr/string_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/thd_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/time_precise.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tls.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tls_gcc.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tls_msvc.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tls_pthread.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tmpfile.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/abstract.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/atomic.h" role="src" />
Expand Down
2 changes: 1 addition & 1 deletion src/core/ext/filters/client_channel/subchannel_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include <grpc/support/alloc.h>
#include <grpc/support/avl.h>
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>

#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/tls.h"

// a map of subchannel_key --> subchannel, used for detecting connections
// to the same destination in order to share them
Expand Down
12 changes: 6 additions & 6 deletions include/grpc/support/tls.h → src/core/lib/gpr/tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*
*/

#ifndef GRPC_SUPPORT_TLS_H
#define GRPC_SUPPORT_TLS_H
#ifndef GRPC_CORE_LIB_GPR_TLS_H
#define GRPC_CORE_LIB_GPR_TLS_H

#include <grpc/support/port_platform.h>

Expand Down Expand Up @@ -54,15 +54,15 @@
ALL functions here may be implemented as macros. */

#ifdef GPR_GCC_TLS
#include <grpc/support/tls_gcc.h>
#include "src/core/lib/gpr/tls_gcc.h"
#endif

#ifdef GPR_MSVC_TLS
#include <grpc/support/tls_msvc.h>
#include "src/core/lib/gpr/tls_msvc.h"
#endif

#ifdef GPR_PTHREAD_TLS
#include <grpc/support/tls_pthread.h>
#include "src/core/lib/gpr/tls_pthread.h"
#endif

#endif /* GRPC_SUPPORT_TLS_H */
#endif /* GRPC_CORE_LIB_GPR_TLS_H */
6 changes: 3 additions & 3 deletions include/grpc/support/tls_gcc.h → src/core/lib/gpr/tls_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*
*/

#ifndef GRPC_SUPPORT_TLS_GCC_H
#define GRPC_SUPPORT_TLS_GCC_H
#ifndef GRPC_CORE_LIB_GPR_TLS_GCC_H
#define GRPC_CORE_LIB_GPR_TLS_GCC_H

#include <stdbool.h>

Expand Down Expand Up @@ -47,4 +47,4 @@ struct gpr_gcc_thread_local {
#define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
#define gpr_tls_get(tls) ((tls)->value)

#endif /* GRPC_SUPPORT_TLS_GCC_H */
#endif /* GRPC_CORE_LIB_GPR_TLS_GCC_H */
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*
*/

#ifndef GRPC_SUPPORT_TLS_MSVC_H
#define GRPC_SUPPORT_TLS_MSVC_H
#ifndef GRPC_CORE_LIB_GPR_TLS_MSVC_H
#define GRPC_CORE_LIB_GPR_TLS_MSVC_H

/** Thread local storage based on ms visual c compiler primitives.
#include tls.h to use this - and see that file for documentation */
Expand Down Expand Up @@ -47,4 +47,4 @@ struct gpr_msvc_thread_local {
#define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
#define gpr_tls_get(tls) ((tls)->value)

#endif /* GRPC_SUPPORT_TLS_MSVC_H */
#endif /* GRPC_CORE_LIB_GPR_TLS_MSVC_H */
2 changes: 1 addition & 1 deletion src/core/lib/gpr/tls_pthread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#ifdef GPR_PTHREAD_TLS

#include <grpc/support/tls.h>
#include "src/core/lib/gpr/tls.h"

intptr_t gpr_tls_set(struct gpr_pthread_thread_local* tls, intptr_t value) {
GPR_ASSERT(0 == pthread_setspecific(tls->key, (void*)value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*
*/

#ifndef GRPC_SUPPORT_TLS_PTHREAD_H
#define GRPC_SUPPORT_TLS_PTHREAD_H
#ifndef GRPC_CORE_LIB_GPR_TLS_PTHREAD_H
#define GRPC_CORE_LIB_GPR_TLS_PTHREAD_H

#include <grpc/support/log.h> /* for GPR_ASSERT */
#include <pthread.h>
Expand Down Expand Up @@ -51,4 +51,4 @@ intptr_t gpr_tls_set(struct gpr_pthread_thread_local* tls, intptr_t value);
}
#endif

#endif /* GRPC_SUPPORT_TLS_PTHREAD_H */
#endif /* GRPC_CORE_LIB_GPR_TLS_PTHREAD_H */
2 changes: 1 addition & 1 deletion src/core/lib/iomgr/ev_epoll1_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
#include <grpc/support/alloc.h>
#include <grpc/support/cpu.h>
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>

#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/ev_posix.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/iomgr/ev_epollex_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@

#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>

#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/spinlock.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/iomgr/ev_epollsig_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@

#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>

#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/ev_posix.h"
Expand Down
Loading

0 comments on commit b6cf123

Please sign in to comment.