Index: third_party/grpc/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h |
diff --git a/third_party/tcmalloc/chromium/src/base/linuxthreads.h b/third_party/grpc/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h |
similarity index 61% |
copy from third_party/tcmalloc/chromium/src/base/linuxthreads.h |
copy to third_party/grpc/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h |
index 5c318fed7ec4c47e7bf082e315992e102abcd620..7b66cd4c32902fa43e1d2b1c9cd6574a429376d0 100644 |
--- a/third_party/tcmalloc/chromium/src/base/linuxthreads.h |
+++ b/third_party/grpc/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h |
@@ -1,4 +1,6 @@ |
-/* Copyright (c) 2005-2007, Google Inc. |
+/* |
+ * |
+ * Copyright 2015-2016, Google Inc. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
@@ -27,27 +29,26 @@ |
* (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 |
*/ |
-#ifndef _LINUXTHREADS_H |
-#define _LINUXTHREADS_H |
- |
-/* Include thread_lister.h to get the interface that we implement for linux. |
- */ |
+#import <Foundation/Foundation.h> |
+#include <grpc/grpc.h> |
-/* We currently only support x86-32 and x86-64 on Linux. Porting to other |
- * related platforms should not be difficult. |
- */ |
-#if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ |
- defined(__mips__) || defined(__PPC__)) && defined(__linux) |
+typedef void(^GRPCQueueCompletionHandler)(bool success); |
-/* Define the THREADS symbol to make sure that there is exactly one core dumper |
- * built into the library. |
+/** |
+ * This class lets one more easily use |grpc_completion_queue|. To use it, pass the value of the |
+ * |unmanagedQueue| property of an instance of this class to |grpc_channel_create_call|. Then for |
+ * every |grpc_call_*| method that accepts a tag, you can pass a block of type |
+ * |GRPCQueueCompletionHandler| (remembering to cast it using |__bridge_retained|). The block is |
+ * guaranteed to eventually be called, by a concurrent queue, and then released. Each such block is |
+ * passed a |bool| that tells if the operation was successful. |
+ * |
+ * Release the GRPCCompletionQueue object only after you are not going to pass any more blocks to |
+ * the |grpc_call| that's using it. |
*/ |
-#define THREADS "Linux /proc" |
- |
-#endif |
+@interface GRPCCompletionQueue : NSObject |
+@property(nonatomic, readonly) grpc_completion_queue *unmanagedQueue; |
-#endif /* _LINUXTHREADS_H */ |
++ (instancetype)completionQueue; |
+@end |