daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Nov 9th, 2018 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func (s *Stack) Push(elm string, done func()) {
  2.     go func() {
  3.         for !s.write.Load() {
  4.         }
  5.  
  6.         s.data[atomic.AddInt32(s.end, 1)-1] = elm
  7.         done()
  8.  
  9.         if atomic.LoadInt32(s.end) <= s.cap {
  10.             s.write.Store(True)
  11.         }
  12.         s.read.Store(True)
  13.     }()
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top