boskos/client/client.go
func (c *Client) AcquireWait(ctx context.Context, rtype, state, dest string) (*common.Resource, error) {
	if ctx == nil {
		return nil, ErrContextRequired
	}
	// Try to acquire the resource until available or the context is
	// cancelled or its deadline exceeded.
	for {
		r, err := c.Acquire(rtype, state, dest)
		if err != nil {
			if err == ErrAlreadyInUse || err == ErrNotFound {
				select {
				case <-ctx.Done():
					return nil, err
				case <-time.After(3 * time.Second):
					continue
				}
			}
			return nil, err
		}
		return r, nil
	}
}
func (c *Client) AcquireWait(ctx context.Context, rtype, state, dest string) (*common.Resource, error) {
	if ctx == nil {
		return nil, ErrContextRequired
	}
	// Try to acquire the resource until available or the context is
	// cancelled or its deadline exceeded.
	for {
		r, err := c.Acquire(rtype, state, dest)
		if err != nil {
			if err == ErrAlreadyInUse || err == ErrNotFound {
				select {
				case <-ctx.Done():
					return nil, err
				case <-time.After(3 * time.Second):
					continue
				}
			}
			return nil, err
		}
		return r, nil
	}
}
func ( c * Client ) AcquireWait ( ctx context . Context , rtype , state , dest string ) ( * common . Resource , error ) { if ctx == nil { return nil , ErrContextRequired } // Try to acquire the resource until available or the context is // cancelled or its deadline exceeded. for { r , err := c . Acquire ( rtype , state , dest ) if err != nil { if err == ErrAlreadyInUse || err == ErrNotFound { select { case <- ctx . Done ( ) : return nil , err case <- time . After ( 3 * time . Second ) : continue } } return nil , err } return r , nil } }
// AcquireWait blocks until Acquire returns the specified resource or the
// provided context is cancelled or its deadline exceeded.
AcquireWait blocks until Acquire returns the specified resource or the provided context is cancelled or its deadline exceeded .