2 * Copyright 2015 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.
17 #ifndef FOLLY_SMALLLOCKS_H_
18 #define FOLLY_SMALLLOCKS_H_
21 * This header defines a few very small mutex types. These are useful
22 * in highly memory-constrained environments where contention is
25 * Note: these locks are for use when you aren't likely to contend on
26 * the critical section, or when the critical section is incredibly
27 * small. Given that, both of the locks defined in this header are
28 * inherently unfair: that is, the longer a thread is waiting, the
29 * longer it waits between attempts to acquire, so newer waiters are
30 * more likely to get the mutex. For the intended use-case this is
33 * @author Keith Adams <kma@fb.com>
34 * @author Jordan DeLong <delong.j@fb.com>
37 #include <folly/MicroSpinLock.h>
38 #include <folly/PicoSpinLock.h>