Cleanup to make compile

pull/10501/head
Craig Tiller 8 years ago
parent 70652147ce
commit e16372ba4b
  1. 8
      src/core/lib/iomgr/ev_epoll_linux.c
  2. 16
      src/core/lib/iomgr/lockfree_event.c

@ -969,7 +969,6 @@ static grpc_fd *fd_create(int fd, const char *name) {
gpr_atm_rel_store(&new_fd->refst, (gpr_atm)1); gpr_atm_rel_store(&new_fd->refst, (gpr_atm)1);
new_fd->fd = fd; new_fd->fd = fd;
gpr_atm_no_barrier_store(&new_fd->shutdown_error, (gpr_atm)GRPC_ERROR_NONE);
new_fd->orphaned = false; new_fd->orphaned = false;
grpc_lfev_init(&new_fd->read_closure); grpc_lfev_init(&new_fd->read_closure);
grpc_lfev_init(&new_fd->write_closure); grpc_lfev_init(&new_fd->write_closure);
@ -1070,9 +1069,10 @@ static bool fd_is_shutdown(grpc_fd *fd) {
/* Might be called multiple times */ /* Might be called multiple times */
static void fd_shutdown(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_error *why) { static void fd_shutdown(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_error *why) {
if (grpc_lfev_set_shutdown(&fd->read_closure, GRPC_ERROR_REF(why))) { if (grpc_lfev_set_shutdown(exec_ctx, &fd->read_closure,
GRPC_ERROR_REF(why))) {
shutdown(fd->fd, SHUT_RDWR); shutdown(fd->fd, SHUT_RDWR);
grpc_lfev_set_shutdown(&fd->write_closure, GRPC_ERROR_REF(why)); grpc_lfev_set_shutdown(exec_ctx, &fd->write_closure, GRPC_ERROR_REF(why));
} }
GRPC_ERROR_UNREF(why); GRPC_ERROR_UNREF(why);
} }
@ -1286,7 +1286,7 @@ static void fd_become_readable(grpc_exec_ctx *exec_ctx, grpc_fd *fd,
} }
static void fd_become_writable(grpc_exec_ctx *exec_ctx, grpc_fd *fd) { static void fd_become_writable(grpc_exec_ctx *exec_ctx, grpc_fd *fd) {
grpc_lfev_set_ready(exec_ctx, fd, &fd->write_closure); grpc_lfev_set_ready(exec_ctx, &fd->write_closure);
} }
static void pollset_release_polling_island(grpc_exec_ctx *exec_ctx, static void pollset_release_polling_island(grpc_exec_ctx *exec_ctx,

@ -69,12 +69,26 @@
#define CLOSURE_NOT_READY ((gpr_atm)0) #define CLOSURE_NOT_READY ((gpr_atm)0)
#define CLOSURE_READY ((gpr_atm)2) #define CLOSURE_READY ((gpr_atm)2)
#define FD_SHUTDOWN_BIT 1 #define FD_SHUTDOWN_BIT ((gpr_atm)1)
void grpc_lfev_init(gpr_atm *state) { void grpc_lfev_init(gpr_atm *state) {
gpr_atm_no_barrier_store(state, CLOSURE_NOT_READY); gpr_atm_no_barrier_store(state, CLOSURE_NOT_READY);
} }
void grpc_lfev_destroy(gpr_atm *state) {
gpr_atm curr = gpr_atm_no_barrier_load(state);
if (curr & FD_SHUTDOWN_BIT) {
GRPC_ERROR_UNREF((grpc_error *)(curr & ~FD_SHUTDOWN_BIT));
} else {
GPR_ASSERT(curr == CLOSURE_NOT_READY || curr == CLOSURE_READY);
}
}
bool grpc_lfev_is_shutdown(gpr_atm *state) {
gpr_atm curr = gpr_atm_no_barrier_load(state);
return (curr & FD_SHUTDOWN_BIT) != 0;
}
void grpc_lfev_notify_on(grpc_exec_ctx *exec_ctx, gpr_atm *state, void grpc_lfev_notify_on(grpc_exec_ctx *exec_ctx, gpr_atm *state,
grpc_closure *closure) { grpc_closure *closure) {
while (true) { while (true) {

Loading…
Cancel
Save