Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: base/message_pump_libevent.cc

Issue 100225: POSIX: Add a macro for handling EINTR. (Closed)
Patch Set: ... Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_pump_glib.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_libevent.cc
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index f2681f39d1ad74534776c4c0372235ce2c8e8dd9..ad36d4497bb09de6a45816d0e887157d6039001e 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -7,6 +7,7 @@
#include <errno.h>
#include <fcntl.h>
+#include "eintr_wrappers.h"
#include "base/logging.h"
#include "base/scoped_nsautorelease_pool.h"
#include "base/scoped_ptr.h"
@@ -87,7 +88,7 @@ void MessagePumpLibevent::OnWakeup(int socket, short flags, void* context) {
// Remove and discard the wakeup byte.
char buf;
- int nread = read(socket, &buf, 1);
+ int nread = HANDLE_EINTR(read(socket, &buf, 1));
DCHECK_EQ(nread, 1);
// Tell libevent to break out of inner loop.
event_base_loopbreak(that->event_base_);
@@ -272,7 +273,7 @@ void MessagePumpLibevent::Quit() {
void MessagePumpLibevent::ScheduleWork() {
// Tell libevent (in a threadsafe way) that it should break out of its loop.
char buf = 0;
- int nwrite = write(wakeup_pipe_in_, &buf, 1);
+ int nwrite = HANDLE_EINTR(write(wakeup_pipe_in_, &buf, 1));
DCHECK(nwrite == 1 || errno == EAGAIN)
<< "[nwrite:" << nwrite << "] [errno:" << errno << "]";
}
« no previous file with comments | « base/message_pump_glib.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698