Skip to content
Snippets Groups Projects
Commit 4a90389f authored by Jacques-Henri Jourdan's avatar Jacques-Henri Jourdan
Browse files

Guards for rwlock are sync.

parent 11e5b308
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -113,7 +113,15 @@ Section rwlockreadguard. ...@@ -113,7 +113,15 @@ Section rwlockreadguard.
eqtype E L (rwlockreadguard α1 ty1) (rwlockreadguard α2 ty2). eqtype E L (rwlockreadguard α1 ty1) (rwlockreadguard α2 ty2).
Proof. intros. by eapply rwlockreadguard_proper. Qed. Proof. intros. by eapply rwlockreadguard_proper. Qed.
(* TODO: In Rust, the read guard is Sync if ty is Send+Sync. *) Global Instance rwlockreadguard_sync α ty :
Sync ty Sync (rwlockreadguard α ty).
Proof.
move=>?????/=. apply uPred.exist_mono=>?. by rewrite sync_change_tid.
Qed.
(* Probably for reasons related to the underlying representation,
Rust does not implement Send for RwLockWriteGuard. We could prove
this. *)
End rwlockreadguard. End rwlockreadguard.
Hint Resolve rwlockreadguard_mono' rwlockreadguard_proper' : lrust_typing. Hint Resolve rwlockreadguard_mono' rwlockreadguard_proper' : lrust_typing.
...@@ -116,7 +116,16 @@ Section rwlockwriteguard. ...@@ -116,7 +116,16 @@ Section rwlockwriteguard.
eqtype E L (rwlockwriteguard α1 ty1) (rwlockwriteguard α2 ty2). eqtype E L (rwlockwriteguard α1 ty1) (rwlockwriteguard α2 ty2).
Proof. intros. by eapply rwlockwriteguard_proper. Qed. Proof. intros. by eapply rwlockwriteguard_proper. Qed.
(* TODO: In Rust, the write guard is Sync if ty is Send+Sync. *) Global Instance rwlockwriteguard_sync α ty :
Sync ty Sync (rwlockwriteguard α ty).
Proof.
move=>?????/=. apply uPred.exist_mono=>?. do 6 f_equiv.
by rewrite sync_change_tid.
Qed.
(* Probably for reasons related to the underlying representation,
Rust does not implement Send for RwLockWriteGuard. We could prove
this. *)
End rwlockwriteguard. End rwlockwriteguard.
Hint Resolve rwlockwriteguard_mono' rwlockwriteguard_proper' : lrust_typing. Hint Resolve rwlockwriteguard_mono' rwlockwriteguard_proper' : lrust_typing.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment