From: Haomai Wang Date: Thu, 30 Apr 2015 14:22:53 +0000 (+0800) Subject: Event: Use atomic cas to avoid missing wakeup X-Git-Tag: v9.0.1~29^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5311eb0e5b9d64808335bb725286ef36a3836807;p=ceph.git Event: Use atomic cas to avoid missing wakeup Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/Event.cc b/src/msg/async/Event.cc index 4bf2d3151a76..daa5fb1b1912 100644 --- a/src/msg/async/Event.cc +++ b/src/msg/async/Event.cc @@ -246,7 +246,7 @@ void EventCenter::delete_time_event(uint64_t id) void EventCenter::wakeup() { - if (!already_wakeup.read()) { + if (already_wakeup.cas(0, 1)) { ldout(cct, 1) << __func__ << dendl; char buf[1]; buf[0] = 'c'; @@ -254,7 +254,6 @@ void EventCenter::wakeup() int n = write(notify_send_fd, buf, 1); // FIXME ? assert(n == 1); - already_wakeup.set(1); } }