34 #ifndef GRPCXX_IMPL_THD_NO_CXX11_H
35 #define GRPCXX_IMPL_THD_NO_CXX11_H
37 #include <grpc/support/thd.h>
43 template<
class T> thread(
void (T::*fptr)(), T *obj) {
44 func_ =
new thread_function<T>(fptr, obj);
49 if (!joined_) std::terminate();
59 gpr_thd_options_set_joinable(&options);
60 gpr_thd_new(&thd_, thread_func, (
void *) func_, &options);
62 static void thread_func(
void *
arg) {
63 thread_function_base *func = (thread_function_base *) arg;
66 class thread_function_base {
68 virtual ~thread_function_base() { }
69 virtual void call() = 0;
72 class thread_function :
public thread_function_base {
74 thread_function(
void (T::*fptr)(), T *obj)
77 virtual void call() { (obj_->*fptr_)(); }
82 thread_function_base *func_;
89 #endif // GRPCXX_IMPL_THD_NO_CXX11_H