Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:40:42

0001 // Copyright 2017 The Abseil Authors.
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //      https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 //
0015 // Core interfaces and definitions used by by low-level interfaces such as
0016 // SpinLock.
0017 
0018 #ifndef ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
0019 #define ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
0020 
0021 #include "absl/base/config.h"
0022 
0023 namespace absl {
0024 ABSL_NAMESPACE_BEGIN
0025 namespace base_internal {
0026 
0027 // Used to describe how a thread may be scheduled.  Typically associated with
0028 // the declaration of a resource supporting synchronized access.
0029 //
0030 // SCHEDULE_COOPERATIVE_AND_KERNEL:
0031 // Specifies that when waiting, a cooperative thread (e.g. a Fiber) may
0032 // reschedule (using base::scheduling semantics); allowing other cooperative
0033 // threads to proceed.
0034 //
0035 // SCHEDULE_KERNEL_ONLY: (Also described as "non-cooperative")
0036 // Specifies that no cooperative scheduling semantics may be used, even if the
0037 // current thread is itself cooperatively scheduled.  This means that
0038 // cooperative threads will NOT allow other cooperative threads to execute in
0039 // their place while waiting for a resource of this type.  Host operating system
0040 // semantics (e.g. a futex) may still be used.
0041 //
0042 // When optional, clients should strongly prefer SCHEDULE_COOPERATIVE_AND_KERNEL
0043 // by default.  SCHEDULE_KERNEL_ONLY should only be used for resources on which
0044 // base::scheduling (e.g. the implementation of a Scheduler) may depend.
0045 //
0046 // NOTE: Cooperative resources may not be nested below non-cooperative ones.
0047 // This means that it is invalid to to acquire a SCHEDULE_COOPERATIVE_AND_KERNEL
0048 // resource if a SCHEDULE_KERNEL_ONLY resource is already held.
0049 enum SchedulingMode {
0050   SCHEDULE_KERNEL_ONLY = 0,         // Allow scheduling only the host OS.
0051   SCHEDULE_COOPERATIVE_AND_KERNEL,  // Also allow cooperative scheduling.
0052 };
0053 
0054 }  // namespace base_internal
0055 ABSL_NAMESPACE_END
0056 }  // namespace absl
0057 
0058 #endif  // ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_