Skip to contentSkip to conversation

Profile likely/unlikely macros

PATCH Mikael Pettersson 1 participant 1 message Apr 25, 2006

lore
Share & tools
lore
#0 lore raw

Review

Quoted 10 lines · Daniel Walker
(quoted diff) +10 -0
+	if (likeliness->type & LIKELY_UNSEEN) {
+		if (atomic_dec_and_test(&likely_lock)) {
+			if (likeliness->type & LIKELY_UNSEEN) {
+				likeliness->type &= (~LIKELY_UNSEEN);
+				likeliness->next = likeliness_head;
+				likeliness_head = likeliness;
+			}
+		}
+		atomic_inc(&likely_lock);
+	}

I'm pretty sure one can do this (prepending an element to a list) w/o fiddling with locks by using CAS and looping until successful.

/Mikael