scheduling_mode.h
Go to the documentation of this file.
1 // Copyright 2017 The Abseil Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // Core interfaces and definitions used by by low-level interfaces such as
16 // SpinLock.
17 
18 #ifndef ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
19 #define ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
20 
21 namespace absl {
22 namespace base_internal {
23 
24 // Used to describe how a thread may be scheduled. Typically associated with
25 // the declaration of a resource supporting synchronized access.
26 //
27 // SCHEDULE_COOPERATIVE_AND_KERNEL:
28 // Specifies that when waiting, a cooperative thread (e.g. a Fiber) may
29 // reschedule (using base::scheduling semantics); allowing other cooperative
30 // threads to proceed.
31 //
32 // SCHEDULE_KERNEL_ONLY: (Also described as "non-cooperative")
33 // Specifies that no cooperative scheduling semantics may be used, even if the
34 // current thread is itself cooperatively scheduled. This means that
35 // cooperative threads will NOT allow other cooperative threads to execute in
36 // their place while waiting for a resource of this type. Host operating system
37 // semantics (e.g. a futex) may still be used.
38 //
39 // When optional, clients should strongly prefer SCHEDULE_COOPERATIVE_AND_KERNEL
40 // by default. SCHEDULE_KERNEL_ONLY should only be used for resources on which
41 // base::scheduling (e.g. the implementation of a Scheduler) may depend.
42 //
43 // NOTE: Cooperative resources may not be nested below non-cooperative ones.
44 // This means that it is invalid to to acquire a SCHEDULE_COOPERATIVE_AND_KERNEL
45 // resource if a SCHEDULE_KERNEL_ONLY resource is already held.
47  SCHEDULE_KERNEL_ONLY = 0, // Allow scheduling only the host OS.
48  SCHEDULE_COOPERATIVE_AND_KERNEL, // Also allow cooperative scheduling.
49 };
50 
51 } // namespace base_internal
52 } // namespace absl
53 
54 #endif // ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
Definition: algorithm.h:29


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:19:57