1 // Copyright 2016 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #ifdef __cplusplus
8 #include <zircon/compiler.h>
9 
10 // Notes about class NullLock
11 //
12 // NullLock is a stub class which exposes the same API as fbl::Mutex, but does
13 // nothing (it neither allocates nor locks).  It may be used with fbl templated
14 // utility classes whose locking behavior is determined by passing a lock class
15 // type as a template parameter to get a no-locking behavior.
16 namespace fbl {
17 
18 class __TA_CAPABILITY("mutex") NullLock {
19 public:
NullLock()20     constexpr NullLock() { }
Acquire()21     void Acquire() __TA_ACQUIRE() { }
Release()22     void Release() __TA_RELEASE() { }
23 };
24 
25 }  // namespace fbl
26 #endif  // ifdef __cplusplus
27