EventCenter::init is called by other thread instead of event thread, so we
need to move create_file_event to set_owner which is called by event thread.
Signed-off-by: Haomai Wang <haomai@xsky.com>
file_events.resize(n);
nevent = n;
- notify_handler = new C_handle_notify(this, cct),
- r = create_file_event(notify_receive_fd, EVENT_READABLE, notify_handler);
- if (r < 0)
- return r;
return 0;
}
::close(notify_send_fd);
delete driver;
- delete notify_handler;
+ if (notify_handler)
+ delete notify_handler;
}
global_centers->centers[idx] = this;
owner = pthread_self();
ldout(cct, 1) << __func__ << " idx=" << idx << " owner=" << owner << dendl;
+
+ notify_handler = new C_handle_notify(this, cct);
+ int r = create_file_event(notify_receive_fd, EVENT_READABLE, notify_handler);
+ assert(r == 0);
}
int EventCenter::create_file_event(int fd, int mask, EventCallbackRef ctxt)