| Index: third_party/grpc/include/grpc/impl/codegen/propagation_bits.h
|
| diff --git a/third_party/tcmalloc/chromium/src/base/thread_lister.c b/third_party/grpc/include/grpc/impl/codegen/propagation_bits.h
|
| similarity index 54%
|
| copy from third_party/tcmalloc/chromium/src/base/thread_lister.c
|
| copy to third_party/grpc/include/grpc/impl/codegen/propagation_bits.h
|
| index bc180dba7a9f2ba3b8261009c8af85f0b1d4a023..cdd699710c2378bd205975f2abfd71c04f57250d 100644
|
| --- a/third_party/tcmalloc/chromium/src/base/thread_lister.c
|
| +++ b/third_party/grpc/include/grpc/impl/codegen/propagation_bits.h
|
| @@ -1,4 +1,6 @@
|
| -/* Copyright (c) 2005-2007, Google Inc.
|
| +/*
|
| + *
|
| + * Copyright 2016, Google Inc.
|
| * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| @@ -27,51 +29,39 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| *
|
| - * ---
|
| - * Author: Markus Gutschke
|
| */
|
|
|
| -#include "config.h"
|
| -#include <stdio.h> /* needed for NULL on some powerpc platforms (?!) */
|
| -#ifdef HAVE_SYS_PRCTL
|
| -# include <sys/prctl.h>
|
| -#endif
|
| -#include "base/thread_lister.h"
|
| -#include "base/linuxthreads.h"
|
| -/* Include other thread listers here that define THREADS macro
|
| - * only when they can provide a good implementation.
|
| - */
|
| +#ifndef GRPC_IMPL_CODEGEN_H
|
| +#define GRPC_IMPL_CODEGEN_H
|
|
|
| -#ifndef THREADS
|
| +#include <grpc/impl/codegen/port_platform.h>
|
|
|
| -/* Default trivial thread lister for single-threaded applications,
|
| - * or if the multi-threading code has not been ported, yet.
|
| - */
|
| +#ifdef __cplusplus
|
| +extern "C" {
|
| +#endif
|
|
|
| -int ListAllProcessThreads(void *parameter,
|
| - ListAllProcessThreadsCallBack callback, ...) {
|
| - int rc;
|
| - va_list ap;
|
| - pid_t pid;
|
| +/* Propagation bits: this can be bitwise or-ed to form propagation_mask for
|
| + * grpc_call */
|
| +/** Propagate deadline */
|
| +#define GRPC_PROPAGATE_DEADLINE ((uint32_t)1)
|
| +/** Propagate census context */
|
| +#define GRPC_PROPAGATE_CENSUS_STATS_CONTEXT ((uint32_t)2)
|
| +#define GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT ((uint32_t)4)
|
| +/** Propagate cancellation */
|
| +#define GRPC_PROPAGATE_CANCELLATION ((uint32_t)8)
|
|
|
| -#ifdef HAVE_SYS_PRCTL
|
| - int dumpable = prctl(PR_GET_DUMPABLE, 0);
|
| - if (!dumpable)
|
| - prctl(PR_SET_DUMPABLE, 1);
|
| -#endif
|
| - va_start(ap, callback);
|
| - pid = getpid();
|
| - rc = callback(parameter, 1, &pid, ap);
|
| - va_end(ap);
|
| -#ifdef HAVE_SYS_PRCTL
|
| - if (!dumpable)
|
| - prctl(PR_SET_DUMPABLE, 0);
|
| -#endif
|
| - return rc;
|
| -}
|
| +/* Default propagation mask: clients of the core API are encouraged to encode
|
| + deltas from this in their implementations... ie write:
|
| + GRPC_PROPAGATE_DEFAULTS & ~GRPC_PROPAGATE_DEADLINE to disable deadline
|
| + propagation. Doing so gives flexibility in the future to define new
|
| + propagation types that are default inherited or not. */
|
| +#define GRPC_PROPAGATE_DEFAULTS \
|
| + ((uint32_t)(( \
|
| + 0xffff | GRPC_PROPAGATE_DEADLINE | GRPC_PROPAGATE_CENSUS_STATS_CONTEXT | \
|
| + GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT | GRPC_PROPAGATE_CANCELLATION)))
|
|
|
| -int ResumeAllProcessThreads(int num_threads, pid_t *thread_pids) {
|
| - return 1;
|
| +#ifdef __cplusplus
|
| }
|
| +#endif
|
|
|
| -#endif /* ifndef THREADS */
|
| +#endif /* GRPC_IMPL_CODEGEN_H */
|
|
|