2 * Copyright 2017 Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 * This header defines a few very small mutex types. These are useful
21 * in highly memory-constrained environments where contention is
24 * Note: these locks are for use when you aren't likely to contend on
25 * the critical section, or when the critical section is incredibly
26 * small. Given that, both of the locks defined in this header are
27 * inherently unfair: that is, the longer a thread is waiting, the
28 * longer it waits between attempts to acquire, so newer waiters are
29 * more likely to get the mutex. For the intended use-case this is
32 * @author Keith Adams <kma@fb.com>
33 * @author Jordan DeLong <delong.j@fb.com>
36 #include <folly/MicroLock.h>
37 #include <folly/MicroSpinLock.h>
39 #include <folly/Portability.h>
40 #if FOLLY_X64 || FOLLY_A64 || FOLLY_PPC64
41 #include <folly/PicoSpinLock.h>