Skip to content

Commit d7cef61

Browse files
committed
re-use function in A module
1 parent 78d3a64 commit d7cef61

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/analyses/creationLockset.ml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,6 @@ module Spec = struct
112112

113113
let name () = "creationLockset"
114114

115-
(** checks if [cl1] has a member ([tp1] |-> [ls1]) and [cl2] has a member ([tp2] |-> [ls2])
116-
such that [ls1] and [ls2] are not disjoint and [tp1] != [tp2]
117-
@param cl1 creation-lockset of first thread [t1]
118-
@param cl2 creation-lockset of second thread [t2]
119-
@returns whether [t1] and [t2] must be running mutually exclusive
120-
*)
121-
let both_protected_inter_threaded cl1 cl2 =
122-
let cl2_has_same_lock_other_tid tp1 ls1 =
123-
G.exists (fun tp2 ls2 -> not (Lockset.disjoint ls1 ls2 || TID.equal tp1 tp2)) cl2
124-
in
125-
G.exists cl2_has_same_lock_other_tid cl1
126-
127115
(** checks if [cl1] has a mapping ([tp1] |-> [ls1])
128116
such that [ls1] and [ls2] are not disjoint and [tp1] != [t2]
129117
@param cl1 creation-lockset of thread [t1] at first program point
@@ -134,6 +122,15 @@ module Spec = struct
134122
let one_protected_inter_threaded_other_intra_threaded cl1 t2 ls2 =
135123
G.exists (fun tp1 ls1 -> not (Lockset.disjoint ls1 ls2 || TID.equal tp1 t2)) cl1
136124

125+
(** checks if [cl1] has a member ([tp1] |-> [ls1]) and [cl2] has a member ([tp2] |-> [ls2])
126+
such that [ls1] and [ls2] are not disjoint and [tp1] != [tp2]
127+
@param cl1 creation-lockset of first thread [t1]
128+
@param cl2 creation-lockset of second thread [t2]
129+
@returns whether [t1] and [t2] must be running mutually exclusive
130+
*)
131+
let both_protected_inter_threaded cl1 cl2 =
132+
G.exists (one_protected_inter_threaded_other_intra_threaded cl1) cl2
133+
137134
let may_race (t1, ls1, cl1) (t2, ls2, cl2) =
138135
not
139136
(both_protected_inter_threaded cl1 cl2

0 commit comments

Comments
 (0)