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

Side by Side Diff: base/synchronization/lock.h

Issue 7461141: Rename BASE_API to BASE_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/synchronization/condition_variable.h ('k') | base/synchronization/lock_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_SYNCHRONIZATION_LOCK_H_ 5 #ifndef BASE_SYNCHRONIZATION_LOCK_H_
6 #define BASE_SYNCHRONIZATION_LOCK_H_ 6 #define BASE_SYNCHRONIZATION_LOCK_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/base_api.h" 9 #include "base/base_export.h"
10 #include "base/synchronization/lock_impl.h" 10 #include "base/synchronization/lock_impl.h"
11 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
12 12
13 namespace base { 13 namespace base {
14 14
15 // A convenient wrapper for an OS specific critical section. The only real 15 // A convenient wrapper for an OS specific critical section. The only real
16 // intelligence in this class is in debug mode for the support for the 16 // intelligence in this class is in debug mode for the support for the
17 // AssertAcquired() method. 17 // AssertAcquired() method.
18 class BASE_API Lock { 18 class BASE_EXPORT Lock {
19 public: 19 public:
20 #if defined(NDEBUG) // Optimized wrapper implementation 20 #if defined(NDEBUG) // Optimized wrapper implementation
21 Lock() : lock_() {} 21 Lock() : lock_() {}
22 ~Lock() {} 22 ~Lock() {}
23 void Acquire() { lock_.Lock(); } 23 void Acquire() { lock_.Lock(); }
24 void Release() { lock_.Unlock(); } 24 void Release() { lock_.Unlock(); }
25 25
26 // If the lock is not held, take it and return true. If the lock is already 26 // If the lock is not held, take it and return true. If the lock is already
27 // held by another thread, immediately return false. This must not be called 27 // held by another thread, immediately return false. This must not be called
28 // by a thread already holding the lock (what happens is undefined and an 28 // by a thread already holding the lock (what happens is undefined and an
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 private: 125 private:
126 Lock& lock_; 126 Lock& lock_;
127 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); 127 DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
128 }; 128 };
129 129
130 } // namespace base 130 } // namespace base
131 131
132 #endif // BASE_SYNCHRONIZATION_LOCK_H_ 132 #endif // BASE_SYNCHRONIZATION_LOCK_H_
OLDNEW
« no previous file with comments | « base/synchronization/condition_variable.h ('k') | base/synchronization/lock_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698