aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-06-23 09:26:21 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-06-23 09:26:21 -0700
commit949b6ee7962aa01a6d3940380d1c3ecc85e85f4a (patch)
treed83f2d71923d2e2d3574ff1850500da69b2923fe /include
parent624babfcd8f0aa26f74b2669c5c0d34ee8b7881a (diff)
parentf8fedc43d76f171b8f87bb65dc5d253e67db996f (diff)
Merge github.com:grpc/grpc into oops-i-split-it-again
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/byte_buffer.h6
-rw-r--r--include/grpc/grpc.h32
-rw-r--r--include/grpc/support/slice.h4
3 files changed, 19 insertions, 23 deletions
diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h
index 3e40eaed1d..2c0f2e6944 100644
--- a/include/grpc++/byte_buffer.h
+++ b/include/grpc++/byte_buffer.h
@@ -48,7 +48,7 @@ class ByteBuffer GRPC_FINAL {
public:
ByteBuffer() : buffer_(nullptr) {}
- ByteBuffer(Slice* slices, size_t nslices);
+ ByteBuffer(const Slice* slices, size_t nslices);
~ByteBuffer() {
if (buffer_) {
@@ -56,10 +56,10 @@ class ByteBuffer GRPC_FINAL {
}
}
- void Dump(std::vector<Slice>* slices);
+ void Dump(std::vector<Slice>* slices) const;
void Clear();
- size_t Length();
+ size_t Length() const;
private:
friend class CallOpBuffer;
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h
index 08662117a0..8b4676562b 100644
--- a/include/grpc/grpc.h
+++ b/include/grpc/grpc.h
@@ -375,10 +375,9 @@ void grpc_completion_queue_shutdown(grpc_completion_queue *cq);
drained and no threads are executing grpc_completion_queue_next */
void grpc_completion_queue_destroy(grpc_completion_queue *cq);
-/* Create a call given a grpc_channel, in order to call 'method'. The request
- is not sent until grpc_call_invoke is called. All completions are sent to
- 'completion_queue'. 'method' and 'host' need only live through the invocation
- of this function. */
+/* Create a call given a grpc_channel, in order to call 'method'. All
+ completions are sent to 'completion_queue'. 'method' and 'host' need only
+ live through the invocation of this function. */
grpc_call *grpc_channel_create_call(grpc_channel *channel,
grpc_completion_queue *completion_queue,
const char *method, const char *host,
@@ -397,7 +396,11 @@ grpc_call *grpc_channel_create_registered_call(
completion of type 'tag' to the completion queue bound to the call.
The order of ops specified in the batch has no significance.
Only one operation of each type can be active at once in any given
- batch. */
+ batch.
+ THREAD SAFETY: access to grpc_call_start_batch in multi-threaded environment
+ needs to be synchronized. As an optimization, you may synchronize batches
+ containing just send operations independently from batches containing just
+ receive operations. */
grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
size_t nops, void *tag);
@@ -415,17 +418,6 @@ grpc_channel *grpc_lame_client_channel_create(void);
/* Close and destroy a grpc channel */
void grpc_channel_destroy(grpc_channel *channel);
-/* THREAD-SAFETY for grpc_call
- The following functions are thread-compatible for any given call:
- grpc_call_add_metadata
- grpc_call_invoke
- grpc_call_start_write
- grpc_call_writes_done
- grpc_call_start_read
- grpc_call_destroy
- The function grpc_call_cancel is thread-safe, and can be called at any
- point before grpc_call_destroy is called. */
-
/* Error handling for grpc_call
Most grpc_call functions return a grpc_error. If the error is not GRPC_OK
then the operation failed due to some unsatisfied precondition.
@@ -433,7 +425,10 @@ void grpc_channel_destroy(grpc_channel *channel);
has been made. */
/* Called by clients to cancel an RPC on the server.
- Can be called multiple times, from any thread. */
+ Can be called multiple times, from any thread.
+ THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status
+ are thread-safe, and can be called at any point before grpc_call_destroy
+ is called.*/
grpc_call_error grpc_call_cancel(grpc_call *call);
/* Called by clients to cancel an RPC on the server.
@@ -446,7 +441,8 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call *call,
grpc_status_code status,
const char *description);
-/* Destroy a call. */
+/* Destroy a call.
+ THREAD SAFETY: grpc_call_destroy is thread-compatible */
void grpc_call_destroy(grpc_call *call);
/* Request notification of a new call. 'cq_for_notification' must
diff --git a/include/grpc/support/slice.h b/include/grpc/support/slice.h
index b558bc515d..ec6c117afe 100644
--- a/include/grpc/support/slice.h
+++ b/include/grpc/support/slice.h
@@ -97,8 +97,8 @@ typedef struct gpr_slice {
((slice).refcount ? (slice).data.refcounted.length \
: (slice).data.inlined.length)
#define GPR_SLICE_SET_LENGTH(slice, newlen) \
- ((slice).refcount ? ((slice).data.refcounted.length = (newlen)) \
- : ((slice).data.inlined.length = (newlen)))
+ ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
+ : ((slice).data.inlined.length = (gpr_uint8)(newlen)))
#define GPR_SLICE_END_PTR(slice) \
GPR_SLICE_START_PTR(slice) + GPR_SLICE_LENGTH(slice)
#define GPR_SLICE_IS_EMPTY(slice) (GPR_SLICE_LENGTH(slice) == 0)