|
|
@ -20,6 +20,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <grpc/support/port_platform.h> |
|
|
|
#include <grpc/support/port_platform.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <string> |
|
|
|
|
|
|
|
|
|
|
|
#include <grpc/support/time.h> |
|
|
|
#include <grpc/support/time.h> |
|
|
|
|
|
|
|
|
|
|
|
#ifdef GPR_POSIX_SYNC |
|
|
|
#ifdef GPR_POSIX_SYNC |
|
|
@ -35,6 +37,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "src/core/lib/gpr/useful.h" |
|
|
|
#include "src/core/lib/gpr/useful.h" |
|
|
|
#include "src/core/lib/gprpp/fork.h" |
|
|
|
#include "src/core/lib/gprpp/fork.h" |
|
|
|
|
|
|
|
#include "src/core/lib/gprpp/strerror.h" |
|
|
|
#include "src/core/lib/gprpp/thd.h" |
|
|
|
#include "src/core/lib/gprpp/thd.h" |
|
|
|
|
|
|
|
|
|
|
|
namespace grpc_core { |
|
|
|
namespace grpc_core { |
|
|
@ -106,7 +109,7 @@ class ThreadInternalsPosix : public internal::ThreadInternalsInterface { |
|
|
|
GPR_ASSERT(pthread_attr_setstacksize(&attr, stack_size) == 0); |
|
|
|
GPR_ASSERT(pthread_attr_setstacksize(&attr, stack_size) == 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
*success = (pthread_create( |
|
|
|
int pthread_create_err = pthread_create( |
|
|
|
&pthread_id_, &attr, |
|
|
|
&pthread_id_, &attr, |
|
|
|
[](void* v) -> void* { |
|
|
|
[](void* v) -> void* { |
|
|
|
thd_arg arg = *static_cast<thd_arg*>(v); |
|
|
|
thd_arg arg = *static_cast<thd_arg*>(v); |
|
|
@ -144,11 +147,14 @@ class ThreadInternalsPosix : public internal::ThreadInternalsInterface { |
|
|
|
} |
|
|
|
} |
|
|
|
return nullptr; |
|
|
|
return nullptr; |
|
|
|
}, |
|
|
|
}, |
|
|
|
info) == 0); |
|
|
|
info); |
|
|
|
|
|
|
|
*success = (pthread_create_err == 0); |
|
|
|
|
|
|
|
|
|
|
|
GPR_ASSERT(pthread_attr_destroy(&attr) == 0); |
|
|
|
GPR_ASSERT(pthread_attr_destroy(&attr) == 0); |
|
|
|
|
|
|
|
|
|
|
|
if (!(*success)) { |
|
|
|
if (!(*success)) { |
|
|
|
|
|
|
|
gpr_log(GPR_ERROR, "pthread_create failed: %s", |
|
|
|
|
|
|
|
StrError(pthread_create_err).c_str()); |
|
|
|
// don't use gpr_free, as this was allocated using malloc (see above)
|
|
|
|
// don't use gpr_free, as this was allocated using malloc (see above)
|
|
|
|
free(info); |
|
|
|
free(info); |
|
|
|
if (options.tracked()) { |
|
|
|
if (options.tracked()) { |
|
|
|