diff options
Diffstat (limited to 'src/svm/ssvm.h')
-rw-r--r-- | src/svm/ssvm.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h index bccfc164bef..8466e15579b 100644 --- a/src/svm/ssvm.h +++ b/src/svm/ssvm.h @@ -102,6 +102,15 @@ ssvm_lock (ssvm_shared_header_t * h, u32 my_pid, u32 tag) } always_inline void +ssvm_lock_non_recursive (ssvm_shared_header_t * h, u32 tag) +{ + while (__sync_lock_test_and_set (&h->lock, 1)) + ; + + h->tag = tag; +} + +always_inline void ssvm_unlock (ssvm_shared_header_t * h) { if (--h->recursion_count == 0) @@ -113,6 +122,14 @@ ssvm_unlock (ssvm_shared_header_t * h) } } +always_inline void +ssvm_unlock_non_recursive (ssvm_shared_header_t * h) +{ + h->tag = 0; + CLIB_MEMORY_BARRIER (); + h->lock = 0; +} + static inline void * ssvm_push_heap (ssvm_shared_header_t * sh) { |