aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/odp_spinlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/odp_spinlock.c')
-rw-r--r--platform/linux-generic/odp_spinlock.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/platform/linux-generic/odp_spinlock.c b/platform/linux-generic/odp_spinlock.c
deleted file mode 100644
index cb0f0533c..000000000
--- a/platform/linux-generic/odp_spinlock.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <odp/api/spinlock.h>
-#include <odp/api/cpu.h>
-#include <odp_atomic_internal.h>
-
-void odp_spinlock_init(odp_spinlock_t *spinlock)
-{
- _odp_atomic_flag_init(&spinlock->lock, 0);
-}
-
-void odp_spinlock_lock(odp_spinlock_t *spinlock)
-{
- /* While the lock is already taken... */
- while (_odp_atomic_flag_tas(&spinlock->lock))
- /* ...spin reading the flag (relaxed MM),
- * the loop will exit when the lock becomes available
- * and we will retry the TAS operation above */
- while (_odp_atomic_flag_load(&spinlock->lock))
- odp_cpu_pause();
-}
-
-int odp_spinlock_trylock(odp_spinlock_t *spinlock)
-{
- return (_odp_atomic_flag_tas(&spinlock->lock) == 0);
-}
-
-void odp_spinlock_unlock(odp_spinlock_t *spinlock)
-{
- _odp_atomic_flag_clear(&spinlock->lock);
-}
-
-int odp_spinlock_is_locked(odp_spinlock_t *spinlock)
-{
- return _odp_atomic_flag_load(&spinlock->lock) != 0;
-}