api: Make channels receive only

This commit is contained in:
Armon Dadgar 2015-01-19 14:37:36 -10:00
parent e9216fa47d
commit 4fef14163d
2 changed files with 2 additions and 2 deletions

View File

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

View File

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