Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Lock{
- private{
- field _:NoDrop;
- field _:NoCopy;
- }
- method enter(self:out Lock){
- *self = {};
- }
- method leave(self:in Lock){
- unsafe{
- drop(*self);
- }
- }
- }
- function foo(){
- var lock:Lock;
- lock.enter();
- lock.leave();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement