Adding portability to gating PicoSpinLock.
[folly.git] / folly / SmallLocks.h
1 /*
2  * Copyright 2016 Facebook, Inc.
3  *
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
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef FOLLY_SMALLLOCKS_H_
18 #define FOLLY_SMALLLOCKS_H_
19
20 /*
21  * This header defines a few very small mutex types.  These are useful
22  * in highly memory-constrained environments where contention is
23  * unlikely.
24  *
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
31  * fine.
32  *
33  * @author Keith Adams <kma@fb.com>
34  * @author Jordan DeLong <delong.j@fb.com>
35  */
36
37 #include <folly/MicroLock.h>
38 #include <folly/MicroSpinLock.h>
39
40 #include <folly/Portability.h>
41 #if FOLLY_X64 || FOLLY_A64 || FOLLY_PPC64
42 #include <folly/PicoSpinLock.h>
43 #endif
44
45 #endif