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

Unified Diff: native_client_sdk/src/libraries/nacl_io/inode_pool.h

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/inode_pool.h
diff --git a/native_client_sdk/src/libraries/nacl_io/inode_pool.h b/native_client_sdk/src/libraries/nacl_io/inode_pool.h
index 4c3f44b36eeb62726d675b61bec7a40dd6f90b5e..57bb0f86dc2c2fa221c538d02e8e1f85bf32dbc5 100644
--- a/native_client_sdk/src/libraries/nacl_io/inode_pool.h
+++ b/native_client_sdk/src/libraries/nacl_io/inode_pool.h
@@ -16,17 +16,10 @@
class INodePool {
public:
- INodePool()
- : max_nodes_(0),
- num_nodes_(0) {
- pthread_mutex_init(&lock_, NULL);
- }
- ~INodePool() {
- pthread_mutex_destroy(&lock_);
- }
+ INodePool() : max_nodes_(0), num_nodes_(0) {}
ino_t Acquire() {
- AutoLock lock(&lock_);
+ AUTO_LOCK(lock_);
const int INO_CNT = 8;
// If we run out of INO numbers, then allocate 8 more
@@ -47,7 +40,7 @@ class INodePool {
}
void Release(ino_t ino) {
- AutoLock lock(&lock_);
+ AUTO_LOCK(lock_);
inos_.push_back(ino);
num_nodes_--;
}
@@ -59,7 +52,7 @@ class INodePool {
size_t num_nodes_;
size_t max_nodes_;
std::vector<ino_t> inos_;
- pthread_mutex_t lock_;
+ SimpleLock lock_;
};
#endif // LIBRARIES_NACL_IO_INODE_POOL_H_

Powered by Google App Engine
This is Rietveld 408576698