mirror of
https://github.com/ceph/ceph
synced 2024-12-17 00:46:05 +00:00
msg/async: make EventCenter notify file event creating when set_owner
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>
This commit is contained in:
parent
e66a48f854
commit
f5d1c05b8f
@ -106,10 +106,6 @@ int EventCenter::init(int n, unsigned i)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -132,7 +128,8 @@ EventCenter::~EventCenter()
|
||||
::close(notify_send_fd);
|
||||
|
||||
delete driver;
|
||||
delete notify_handler;
|
||||
if (notify_handler)
|
||||
delete notify_handler;
|
||||
}
|
||||
|
||||
|
||||
@ -144,6 +141,10 @@ void EventCenter::set_owner()
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user