aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-08-18 12:51:05 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-08-18 12:51:05 -0700
commit128f4a9cfe34825543dab4e29c875b59af40e666 (patch)
tree323e79e6d7dd98ef6aa23f93ec20736d10abd9ce /include/grpc++/impl
parentf2066040d2568e6ae90f6690fab91c63cd17fd6b (diff)
parent4f21d3549c8f652a152ae086a74dd8415ecca8fa (diff)
Merge github.com:grpc/grpc into y12kdm3
Diffstat (limited to 'include/grpc++/impl')
-rw-r--r--include/grpc++/impl/grpc_library.h1
-rw-r--r--include/grpc++/impl/serialization_traits.h6
-rw-r--r--include/grpc++/impl/sync_no_cxx11.h8
-rw-r--r--include/grpc++/impl/thd_no_cxx11.h21
4 files changed, 20 insertions, 16 deletions
diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h
index f9fa677901..ce4211418d 100644
--- a/include/grpc++/impl/grpc_library.h
+++ b/include/grpc++/impl/grpc_library.h
@@ -46,5 +46,4 @@ class GrpcLibrary {
} // namespace grpc
-
#endif // GRPCXX_IMPL_GRPC_LIBRARY_H
diff --git a/include/grpc++/impl/serialization_traits.h b/include/grpc++/impl/serialization_traits.h
index 1f5c674e4c..3ea66a3405 100644
--- a/include/grpc++/impl/serialization_traits.h
+++ b/include/grpc++/impl/serialization_traits.h
@@ -37,12 +37,12 @@
namespace grpc {
/// Defines how to serialize and deserialize some type.
-///
+///
/// Used for hooking different message serialization API's into GRPC.
/// Each SerializationTraits implementation must provide the following
/// functions:
/// static Status Serialize(const Message& msg,
-/// grpc_byte_buffer** buffer,
+/// grpc_byte_buffer** buffer,
// bool* own_buffer);
/// static Status Deserialize(grpc_byte_buffer* buffer,
/// Message* msg,
@@ -57,7 +57,7 @@ namespace grpc {
/// msg. max_message_size is passed in as a bound on the maximum number of
/// message bytes Deserialize should accept.
///
-/// Both functions return a Status, allowing them to explain what went
+/// Both functions return a Status, allowing them to explain what went
/// wrong if required.
template <class Message,
class UnusedButHereForPartialTemplateSpecialization = void>
diff --git a/include/grpc++/impl/sync_no_cxx11.h b/include/grpc++/impl/sync_no_cxx11.h
index 5869b04c76..120a031045 100644
--- a/include/grpc++/impl/sync_no_cxx11.h
+++ b/include/grpc++/impl/sync_no_cxx11.h
@@ -38,7 +38,7 @@
namespace grpc {
-template<class mutex>
+template <class mutex>
class lock_guard;
class condition_variable;
@@ -46,6 +46,7 @@ class mutex {
public:
mutex() { gpr_mu_init(&mu_); }
~mutex() { gpr_mu_destroy(&mu_); }
+
private:
::gpr_mu mu_;
template <class mutex>
@@ -58,6 +59,7 @@ class lock_guard {
public:
lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); }
~lock_guard() { unlock_internal(); }
+
protected:
void lock_internal() {
if (!locked) gpr_mu_lock(&mu_.mu_);
@@ -67,6 +69,7 @@ class lock_guard {
if (locked) gpr_mu_unlock(&mu_.mu_);
locked = false;
}
+
private:
mutex &mu_;
bool locked;
@@ -76,7 +79,7 @@ class lock_guard {
template <class mutex>
class unique_lock : public lock_guard<mutex> {
public:
- unique_lock(mutex &mu) : lock_guard<mutex>(mu) { }
+ unique_lock(mutex &mu) : lock_guard<mutex>(mu) {}
void lock() { this->lock_internal(); }
void unlock() { this->unlock_internal(); }
};
@@ -92,6 +95,7 @@ class condition_variable {
}
void notify_one() { gpr_cv_signal(&cv_); }
void notify_all() { gpr_cv_broadcast(&cv_); }
+
private:
gpr_cv cv_;
};
diff --git a/include/grpc++/impl/thd_no_cxx11.h b/include/grpc++/impl/thd_no_cxx11.h
index a6bdd7dfe9..84d03ce184 100644
--- a/include/grpc++/impl/thd_no_cxx11.h
+++ b/include/grpc++/impl/thd_no_cxx11.h
@@ -40,7 +40,8 @@ namespace grpc {
class thread {
public:
- template<class T> thread(void (T::*fptr)(), T *obj) {
+ template <class T>
+ thread(void (T::*fptr)(), T *obj) {
func_ = new thread_function<T>(fptr, obj);
joined_ = false;
start();
@@ -53,28 +54,28 @@ class thread {
gpr_thd_join(thd_);
joined_ = true;
}
+
private:
void start() {
gpr_thd_options options = gpr_thd_options_default();
gpr_thd_options_set_joinable(&options);
- gpr_thd_new(&thd_, thread_func, (void *) func_, &options);
+ gpr_thd_new(&thd_, thread_func, (void *)func_, &options);
}
static void thread_func(void *arg) {
- thread_function_base *func = (thread_function_base *) arg;
+ thread_function_base *func = (thread_function_base *)arg;
func->call();
}
class thread_function_base {
public:
- virtual ~thread_function_base() { }
+ virtual ~thread_function_base() {}
virtual void call() = 0;
};
- template<class T>
+ template <class T>
class thread_function : public thread_function_base {
public:
- thread_function(void (T::*fptr)(), T *obj)
- : fptr_(fptr)
- , obj_(obj) { }
+ thread_function(void (T::*fptr)(), T *obj) : fptr_(fptr), obj_(obj) {}
virtual void call() { (obj_->*fptr_)(); }
+
private:
void (T::*fptr_)();
T *obj_;
@@ -84,8 +85,8 @@ class thread {
bool joined_;
// Disallow copy and assign.
- thread(const thread&);
- void operator=(const thread&);
+ thread(const thread &);
+ void operator=(const thread &);
};
} // namespace grpc