clang-format

pull/10892/head^2
Craig Tiller 8 years ago
parent 9ddb3151d6
commit f8382b80ca
  1. 15
      src/core/lib/iomgr/ev_epollsig_linux.c
  2. 6
      src/core/lib/iomgr/ev_posix.c

@ -1921,7 +1921,8 @@ static bool is_epoll_available() {
return true; return true;
} }
const grpc_event_engine_vtable *grpc_init_epollsig_linux(bool explicit_request) { const grpc_event_engine_vtable *grpc_init_epollsig_linux(
bool explicit_request) {
/* If use of signals is disabled, we cannot use epoll engine*/ /* If use of signals is disabled, we cannot use epoll engine*/
if (is_grpc_wakeup_signal_initialized && grpc_wakeup_signal < 0) { if (is_grpc_wakeup_signal_initialized && grpc_wakeup_signal < 0) {
return NULL; return NULL;
@ -1936,8 +1937,11 @@ const grpc_event_engine_vtable *grpc_init_epollsig_linux(bool explicit_request)
} }
if (!is_grpc_wakeup_signal_initialized) { if (!is_grpc_wakeup_signal_initialized) {
if (explicit_request) grpc_use_signal(SIGRTMIN + 6); if (explicit_request) {
else return NULL; grpc_use_signal(SIGRTMIN + 6);
} else {
return NULL;
}
} }
fd_global_init(); fd_global_init();
@ -1959,7 +1963,10 @@ const grpc_event_engine_vtable *grpc_init_epollsig_linux(bool explicit_request)
#include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/ev_posix.h"
/* If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return /* If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return
* NULL */ * NULL */
const grpc_event_engine_vtable *grpc_init_epollsig_linux(bool explicit_request) { return NULL; } const grpc_event_engine_vtable *grpc_init_epollsig_linux(
bool explicit_request) {
return NULL;
}
#endif /* defined(GRPC_POSIX_SOCKET) */ #endif /* defined(GRPC_POSIX_SOCKET) */
void grpc_use_signal(int signum) {} void grpc_use_signal(int signum) {}

@ -58,7 +58,8 @@ grpc_wakeup_fd grpc_global_wakeup_fd;
static const grpc_event_engine_vtable *g_event_engine; static const grpc_event_engine_vtable *g_event_engine;
static const char *g_poll_strategy_name = NULL; static const char *g_poll_strategy_name = NULL;
typedef const grpc_event_engine_vtable *(*event_engine_factory_fn)(bool explicit_request); typedef const grpc_event_engine_vtable *(*event_engine_factory_fn)(
bool explicit_request);
typedef struct { typedef struct {
const char *name; const char *name;
@ -104,7 +105,8 @@ static bool is(const char *want, const char *have) {
static void try_engine(const char *engine) { static void try_engine(const char *engine) {
for (size_t i = 0; i < GPR_ARRAY_SIZE(g_factories); i++) { for (size_t i = 0; i < GPR_ARRAY_SIZE(g_factories); i++) {
if (is(engine, g_factories[i].name)) { if (is(engine, g_factories[i].name)) {
if ((g_event_engine = g_factories[i].factory(0 == strcmp(engine, g_factories[i].name)))) { if ((g_event_engine = g_factories[i].factory(
0 == strcmp(engine, g_factories[i].name)))) {
g_poll_strategy_name = g_factories[i].name; g_poll_strategy_name = g_factories[i].name;
gpr_log(GPR_DEBUG, "Using polling engine: %s", g_factories[i].name); gpr_log(GPR_DEBUG, "Using polling engine: %s", g_factories[i].name);
return; return;

Loading…
Cancel
Save