Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lock = lock + HIGH_HALF_INC; /* overflow expected */
}
- do
- :: 1 ->
- if
- :: (LOW_HALF(lock) == ticket) ->
- break;
- :: else ->
- skip;
- fi;
- od;
+ /* busy-wait */
+ LOW_HALF(lock) == ticket -> 1;
}
inline spin_unlock(lock)
byte ticket;
do
- :: 1 ->
-progress_A:
+ ::
spin_lock(lock, ticket);
+progress_A:
refcount = refcount + 1;
refcount = refcount - 1;
spin_unlock(lock);
byte ticket;
do
- :: 1 ->
- spin_lock(lock, ticket);
+ :: spin_lock(lock, ticket);
refcount = refcount + 1;
refcount = refcount - 1;
spin_unlock(lock);
lock = lock + HIGH_HALF_INC; /* overflow expected */
}
- do
- :: 1 ->
- if
- :: (LOW_HALF(lock) == ticket) ->
- break;
- :: else ->
- skip;
- fi;
- od;
+ /* busy-wait */
+ LOW_HALF(lock) == ticket -> 1;
}
inline spin_unlock(lock)
byte ticket;
do
- :: 1->
- spin_lock(lock, ticket);
+ :: spin_lock(lock, ticket);
refcount = refcount + 1;
refcount = refcount - 1;
spin_unlock(lock);