ofproto: Inline trivial functions.
[sliver-openvswitch.git] / lib / seq.c
index abe1ad8..7a34244 100644 (file)
--- a/lib/seq.c
+++ b/lib/seq.c
@@ -52,7 +52,7 @@ struct seq_thread {
     bool waiting OVS_GUARDED;        /* True if latch_wait() already called. */
 };
 
-static struct ovs_mutex seq_mutex = OVS_ADAPTIVE_MUTEX_INITIALIZER;
+static struct ovs_mutex seq_mutex = OVS_MUTEX_INITIALIZER;
 
 static uint64_t seq_next OVS_GUARDED_BY(seq_mutex) = 1;
 
@@ -106,7 +106,11 @@ seq_change(struct seq *seq)
     ovs_mutex_unlock(&seq_mutex);
 }
 
-/* Returns 'seq''s current sequence number (which could change immediately). */
+/* Returns 'seq''s current sequence number (which could change immediately).
+ *
+ * seq_read() and seq_wait() can be used together to yield a race-free wakeup
+ * when an object changes, even without an ability to lock the object.  See
+ * Usage in seq.h for details. */
 uint64_t
 seq_read(const struct seq *seq)
     OVS_EXCLUDED(seq_mutex)
@@ -144,6 +148,7 @@ seq_wait__(struct seq *seq, uint64_t value)
     waiter = xmalloc(sizeof *waiter);
     waiter->seq = seq;
     hmap_insert(&seq->waiters, &waiter->hmap_node, hash);
+    waiter->ovsthread_id = id;
     waiter->value = value;
     waiter->thread = seq_thread_get();
     list_push_back(&waiter->thread->waiters, &waiter->list_node);
@@ -156,7 +161,11 @@ seq_wait__(struct seq *seq, uint64_t value)
 
 /* Causes the following poll_block() to wake up when 'seq''s sequence number
  * changes from 'value'.  (If 'seq''s sequence number isn't 'value', then
- * poll_block() won't block at all.) */
+ * poll_block() won't block at all.)
+ *
+ * seq_read() and seq_wait() can be used together to yield a race-free wakeup
+ * when an object changes, even without an ability to lock the object.  See
+ * Usage in seq.h for details. */
 void
 seq_wait(const struct seq *seq_, uint64_t value)
     OVS_EXCLUDED(seq_mutex)