Browse Source

api: Make channels receive only

pull/619/head
Armon Dadgar 10 years ago
parent
commit
4fef14163d
  1. 2
      api/lock.go
  2. 2
      api/semaphore.go

2
api/lock.go

@ -103,7 +103,7 @@ func (c *Client) LockOpts(opts *LockOptions) (*Lock, error) {
// created without any associated health checks. By default Consul sessions
// prefer liveness over safety and an application must be able to handle
// the lock being lost.
func (l *Lock) Lock(stopCh chan struct{}) (chan struct{}, error) {
func (l *Lock) Lock(stopCh <-chan struct{}) (<-chan struct{}, error) {
// Hold the lock as we try to acquire
l.l.Lock()
defer l.l.Unlock()

2
api/semaphore.go

@ -128,7 +128,7 @@ func (c *Client) SemaphoreOpts(opts *SemaphoreOptions) (*Semaphore, error) {
// created without any associated health checks. By default Consul sessions
// prefer liveness over safety and an application must be able to handle
// the session being lost.
func (s *Semaphore) Acquire(stopCh chan struct{}) (chan struct{}, error) {
func (s *Semaphore) Acquire(stopCh <-chan struct{}) (<-chan struct{}, error) {
// Hold the lock as we try to acquire
s.l.Lock()
defer s.l.Unlock()

Loading…
Cancel
Save