Advertisement
tinyevil

Untitled

Jun 21st, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. struct Lock{
  2. private{
  3. field _:NoDrop;
  4. field _:NoCopy;
  5. }
  6.  
  7. method enter(self:out Lock){
  8. *self = {};
  9. }
  10.  
  11. method leave(self:in Lock){
  12. unsafe{
  13. drop(*self);
  14. }
  15. }
  16.  
  17. }
  18.  
  19.  
  20.  
  21.  
  22. function foo(){
  23. var lock:Lock;
  24.  
  25. lock.enter();
  26.  
  27. lock.leave();
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement