Horizontal (nSessions) scaling draft
[vpp.git] / src / svm / ssvm.h
index bccfc16..8466e15 100644 (file)
@@ -101,6 +101,15 @@ ssvm_lock (ssvm_shared_header_t * h, u32 my_pid, u32 tag)
   h->tag = 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)
 {
@@ -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)
 {