Index: third_party/grpc/src/core/support/thd.c |
diff --git a/third_party/tcmalloc/vendor/src/base/synchronization_profiling.h b/third_party/grpc/src/core/support/thd.c |
similarity index 65% |
copy from third_party/tcmalloc/vendor/src/base/synchronization_profiling.h |
copy to third_party/grpc/src/core/support/thd.c |
index cf02c218a111806189f71f7b528a83b5ceb164a4..41daeb5d0e5e3c49a3603f2fd9ae5009a98fd1d2 100644 |
--- a/third_party/tcmalloc/vendor/src/base/synchronization_profiling.h |
+++ b/third_party/grpc/src/core/support/thd.c |
@@ -1,4 +1,6 @@ |
-/* Copyright (c) 2010, Google Inc. |
+/* |
+ * |
+ * Copyright 2015, Google Inc. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
@@ -27,24 +29,36 @@ |
* (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: Chris Ruemmler |
*/ |
-#ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |
-#define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |
+/* Posix implementation for gpr threads. */ |
+ |
+#include <memory.h> |
-#include "base/basictypes.h" |
+#include <grpc/support/thd.h> |
-namespace base { |
+enum { GPR_THD_JOINABLE = 1 }; |
-// We can do contention-profiling of SpinLocks, but the code is in |
-// mutex.cc, which is not always linked in with spinlock. Hence we |
-// provide a weak definition, which are used if mutex.cc isn't linked in. |
+gpr_thd_options gpr_thd_options_default(void) { |
+ gpr_thd_options options; |
+ memset(&options, 0, sizeof(options)); |
+ return options; |
+} |
+ |
+void gpr_thd_options_set_detached(gpr_thd_options* options) { |
+ options->flags &= ~GPR_THD_JOINABLE; |
+} |
+ |
+void gpr_thd_options_set_joinable(gpr_thd_options* options) { |
+ options->flags |= GPR_THD_JOINABLE; |
+} |
+ |
+int gpr_thd_options_is_detached(const gpr_thd_options* options) { |
+ if (!options) return 1; |
+ return (options->flags & GPR_THD_JOINABLE) == 0; |
+} |
-// Submit the number of cycles the spinlock spent contending. |
-ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64); |
-extern void SubmitSpinLockProfileData(const void *contendedlock, |
- int64 wait_cycles) {} |
+int gpr_thd_options_is_joinable(const gpr_thd_options* options) { |
+ if (!options) return 0; |
+ return (options->flags & GPR_THD_JOINABLE) == GPR_THD_JOINABLE; |
} |
-#endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |