github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/pkg/sync/runtime.go (about)

     1  // Copyright 2012 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package sync
     6  
     7  import "unsafe"
     8  
     9  // defined in package runtime
    10  
    11  // Semacquire waits until *s > 0 and then atomically decrements it.
    12  // It is intended as a simple sleep primitive for use by the synchronization
    13  // library and should not be used directly.
    14  func runtime_Semacquire(s *uint32)
    15  
    16  // Semrelease atomically increments *s and notifies a waiting goroutine
    17  // if one is blocked in Semacquire.
    18  // It is intended as a simple wakeup primitive for use by the synchronization
    19  // library and should not be used directly.
    20  func runtime_Semrelease(s *uint32)
    21  
    22  // Opaque representation of SyncSema in runtime/sema.goc.
    23  type syncSema [3]uintptr
    24  
    25  // Syncsemacquire waits for a pairing Syncsemrelease on the same semaphore s.
    26  func runtime_Syncsemacquire(s *syncSema)
    27  
    28  // Syncsemrelease waits for n pairing Syncsemacquire on the same semaphore s.
    29  func runtime_Syncsemrelease(s *syncSema, n uint32)
    30  
    31  // Ensure that sync and runtime agree on size of syncSema.
    32  func runtime_Syncsemcheck(size uintptr)
    33  func init() {
    34  	var s syncSema
    35  	runtime_Syncsemcheck(unsafe.Sizeof(s))
    36  }