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

Unified Diff: native_client_sdk/src/libraries/nacl_io/mount_dev.cc

Issue 18644009: [NaCl SDK] Upate atomic ops in nacl_io (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add declartions for newval and oldval Created 7 years, 5 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
Index: native_client_sdk/src/libraries/nacl_io/mount_dev.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/mount_dev.cc b/native_client_sdk/src/libraries/nacl_io/mount_dev.cc
index 99d8834ff480bd1baa8501c4d963c297a7659712..e180ef5fade582fa1d4093f42ec1e5e8c150a35a 100644
--- a/native_client_sdk/src/libraries/nacl_io/mount_dev.cc
+++ b/native_client_sdk/src/libraries/nacl_io/mount_dev.cc
@@ -220,7 +220,7 @@ Error TtyNode::Write(size_t offs,
const char* data = static_cast<const char*>(buf);
std::string message;
{
- AutoLock lock(&lock_);
+ AUTO_LOCK(node_lock_);
message = prefix_;
}
message.append(data, count);
@@ -232,9 +232,9 @@ Error TtyNode::Write(size_t offs,
}
Error TtyNode::Read(size_t offs, void* buf, size_t count, int* out_bytes) {
- AutoLock lock(&lock_);
+ AUTO_LOCK(node_lock_);
while (input_buffer_.size() <= 0) {
- pthread_cond_wait(&is_readable_, &lock_);
+ pthread_cond_wait(&is_readable_, node_lock_.mutex());
}
// Copies data from the input buffer into buf.
@@ -253,7 +253,7 @@ Error TtyNode::Ioctl(int request, char* arg) {
// The prefix is used to distinguish messages intended for this
// tty node from all the other messages cluttering up the
// javascript postMessage() channel.
- AutoLock lock(&lock_);
+ AUTO_LOCK(node_lock_);
prefix_ = arg;
return 0;
} else if (request == TIOCNACLINPUT) {
@@ -262,7 +262,7 @@ Error TtyNode::Ioctl(int request, char* arg) {
// prefix for this node, and only deliver the data if so.
struct tioc_nacl_input_string* message =
reinterpret_cast<struct tioc_nacl_input_string*>(arg);
- AutoLock lock(&lock_);
+ AUTO_LOCK(node_lock_);
if (message->length >= prefix_.size() &&
strncmp(message->buffer, prefix_.data(), prefix_.size()) == 0) {
input_buffer_.insert(input_buffer_.end(),
@@ -363,7 +363,6 @@ Error MountDev::Access(const Path& path, int a_mode) {
Error MountDev::Open(const Path& path, int mode, ScopedMountNode* out_node) {
out_node->reset(NULL);
- AutoLock lock(&lock_);
// Don't allow creating any files.
if (mode & O_CREAT)

Powered by Google App Engine
This is Rietveld 408576698