summaryrefslogtreecommitdiff
path: root/absl/base/internal
diff options
context:
space:
mode:
Diffstat (limited to 'absl/base/internal')
-rw-r--r--absl/base/internal/malloc_hook.cc1
-rw-r--r--absl/base/internal/spinlock.cc5
-rw-r--r--absl/base/internal/spinlock.h6
-rw-r--r--absl/base/internal/sysinfo.cc2
-rw-r--r--absl/base/internal/thread_identity_test.cc1
5 files changed, 10 insertions, 5 deletions
diff --git a/absl/base/internal/malloc_hook.cc b/absl/base/internal/malloc_hook.cc
index 7165d4cb..52531c68 100644
--- a/absl/base/internal/malloc_hook.cc
+++ b/absl/base/internal/malloc_hook.cc
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include "absl/base/attributes.h"
#include "absl/base/config.h"
#if ABSL_HAVE_MMAP
diff --git a/absl/base/internal/spinlock.cc b/absl/base/internal/spinlock.cc
index 3ac1f4dc..28a2059f 100644
--- a/absl/base/internal/spinlock.cc
+++ b/absl/base/internal/spinlock.cc
@@ -83,11 +83,6 @@ void RegisterSpinLockProfiler(void (*fn)(const void *contendedlock,
submit_profile_data.Store(fn);
}
-static inline bool IsCooperative(
- base_internal::SchedulingMode scheduling_mode) {
- return scheduling_mode == base_internal::SCHEDULE_COOPERATIVE_AND_KERNEL;
-}
-
// Uncommon constructors.
SpinLock::SpinLock(base_internal::SchedulingMode mode)
: lockword_(IsCooperative(mode) ? kSpinLockCooperative : 0) {
diff --git a/absl/base/internal/spinlock.h b/absl/base/internal/spinlock.h
index f486f68a..a9037e3e 100644
--- a/absl/base/internal/spinlock.h
+++ b/absl/base/internal/spinlock.h
@@ -151,6 +151,12 @@ class LOCKABLE SpinLock {
enum { kWaitTimeMask = // Includes kSpinLockSleeper.
~(kSpinLockHeld | kSpinLockCooperative | kSpinLockDisabledScheduling) };
+ // Returns true if the provided scheduling mode is cooperative.
+ static constexpr bool IsCooperative(
+ base_internal::SchedulingMode scheduling_mode) {
+ return scheduling_mode == base_internal::SCHEDULE_COOPERATIVE_AND_KERNEL;
+ }
+
uint32_t TryLockInternal(uint32_t lock_value, uint32_t wait_cycles);
void InitLinkerInitializedAndCooperative();
void SlowLock() ABSL_ATTRIBUTE_COLD;
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc
index 884c3126..dca7d8fd 100644
--- a/absl/base/internal/sysinfo.cc
+++ b/absl/base/internal/sysinfo.cc
@@ -14,6 +14,8 @@
#include "absl/base/internal/sysinfo.h"
+#include "absl/base/attributes.h"
+
#ifdef _WIN32
#include <shlwapi.h>
#include <windows.h>
diff --git a/absl/base/internal/thread_identity_test.cc b/absl/base/internal/thread_identity_test.cc
index 7695a091..ecb8af68 100644
--- a/absl/base/internal/thread_identity_test.cc
+++ b/absl/base/internal/thread_identity_test.cc
@@ -18,6 +18,7 @@
#include <vector>
#include "gtest/gtest.h"
+#include "absl/base/attributes.h"
#include "absl/base/internal/spinlock.h"
#include "absl/base/macros.h"
#include "absl/synchronization/internal/per_thread_sem.h"