blob: b3117c2c560d71de5c2378100c76b06265f25864 [file] [log] [blame]
// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FBL_NULL_LOCK_H_
#define FBL_NULL_LOCK_H_
#ifdef __cplusplus
#include <zircon/compiler.h>
// Notes about class NullLock
// NullLock is a stub class which exposes the same API as fbl::Mutex, but does
// nothing (it neither allocates nor locks). It may be used with fbl templated
// utility classes whose locking behavior is determined by passing a lock class
// type as a template parameter to get a no-locking behavior.
namespace fbl {
class __TA_CAPABILITY("mutex") NullLock {
constexpr NullLock() { }
void Acquire() __TA_ACQUIRE() { }
void Release() __TA_RELEASE() { }
} // namespace fbl
#endif // ifdef __cplusplus
#endif // FBL_NULL_LOCK_H_