From ee533bd6d43fed338d4a8e23d1417b8096c1f48f Mon Sep 17 00:00:00 2001 From: "sbc@chromium.org" Date: Wed, 18 Sep 2013 16:32:34 +0000 Subject: [NaCl SDK] nacl_io: On SIGWINCH don't interrupt calls to read(2) On linux at least its only select/poll that error out with EINTR when such signals arrive, not read/write. This was causing nethack to exit on startup. R=binji@chromium.org, binji Review URL: https://codereview.chromium.org/23926020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223889 0039d316-1c4b-4281-b951-d872f2087c98 --- native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc | 15 --------------- native_client_sdk/src/libraries/nacl_io/mount_node_tty.h | 1 - 2 files changed, 16 deletions(-) (limited to 'native_client_sdk') diff --git a/native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc b/native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc index 534e53a..5a2fc7a 100644 --- a/native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc +++ b/native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc @@ -34,7 +34,6 @@ namespace nacl_io { MountNodeTty::MountNodeTty(Mount* mount) : MountNodeCharDevice(mount), is_readable_(false), - did_resize_(false), rows_(DEFAULT_TTY_ROWS), cols_(DEFAULT_TTY_COLS) { output_handler_.handler = NULL; @@ -100,15 +99,8 @@ Error MountNodeTty::Write(size_t offs, Error MountNodeTty::Read(size_t offs, void* buf, size_t count, int* out_bytes) { AUTO_LOCK(node_lock_); - did_resize_ = false; while (!is_readable_) { pthread_cond_wait(&is_readable_cond_, node_lock_.mutex()); - if (!is_readable_ && did_resize_) { - // If an async resize event occured then return the failure and - // set EINTR. - *out_bytes = 0; - return EINTR; - } } size_t bytes_to_copy = std::min(count, input_buffer_.size()); @@ -259,13 +251,6 @@ Error MountNodeTty::Ioctl(int request, char* arg) { cols_ = size->ws_col; } kill(getpid(), SIGWINCH); - - // Wake up any thread waiting on Read - { - AUTO_LOCK(node_lock_); - did_resize_ = true; - pthread_cond_broadcast(&is_readable_cond_); - } return 0; } case TIOCGWINSZ: { diff --git a/native_client_sdk/src/libraries/nacl_io/mount_node_tty.h b/native_client_sdk/src/libraries/nacl_io/mount_node_tty.h index 8bf5b17..c8070b9 100644 --- a/native_client_sdk/src/libraries/nacl_io/mount_node_tty.h +++ b/native_client_sdk/src/libraries/nacl_io/mount_node_tty.h @@ -53,7 +53,6 @@ class MountNodeTty : public MountNodeCharDevice { std::deque input_buffer_; bool is_readable_; - bool did_resize_; pthread_cond_t is_readable_cond_; struct termios termios_; -- cgit v1.1