Skip to content

Commit

Permalink
simplify spin lock example
Browse files Browse the repository at this point in the history
  • Loading branch information
gebner committed Nov 8, 2024
1 parent cdfef59 commit 0f24809
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions share/pulse/examples/PulseCorePaper.S2.Lock.fst
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,14 @@ let lock_inv r p : slprop = exists* v. Box.pts_to r v ** (maybe (v = 0ul) p)
let protects l p = inv l.i (lock_inv l.r p)


atomic
fn mk_lock (r:Box.box U32.t) (i:iname) #p
requires inv i (lock_inv r p)
returns l:lock
ensures protects l p
{
let res = {r;i};
rewrite each r as res.r, i as res.i; (* proof hint *)
res
}



fn create (p:slprop)
requires p
returns l:lock
ensures protects l p
{
let r = Box.alloc 0ul;
let i = new_invariant (lock_inv r p);
mk_lock r i
({r; i} <: lock)
}


Expand Down

0 comments on commit 0f24809

Please sign in to comment.