// Do execute a new func
492471
func (d *Do) Do(fn func()) {
	// Add job
	d.mq.Lock()
	d.queue = append(d.queue, fn)
	d.mq.Unlock()

	// Broadcast
	d.cond.L.Lock()
	d.cond.Broadcast()
	d.cond.L.Unlock()
}
481522
func (c Client) do(req *http.Request) (*http.Response, error) {
	resp, err := c.httpClient.Do(req)
	if err != nil {
		// Handle this specifically for now until future Golang versions fix this issue properly.
		if urlErr, ok := err.(*url.Error); ok {
			if strings.Contains(urlErr.Err.Error(), "EOF") {
				return nil, &url.Error{
					Op:  urlErr.Op,
					URL: urlErr.URL,
					Err: errors.New("Connection closed by foreign host " + urlErr.URL + ". Retry again."),
				}
			}
		}
		return nil, err
	}

	// Response cannot be non-nil, report error if thats the case.
	if resp == nil {
		msg := "Response is empty. " + reportIssue
		return nil, ErrInvalidArgument(msg)
	}

	// If trace is enabled, dump http request and response.
	if c.isTraceEnabled {
		err = c.dumpHTTP(req, resp)
		if err != nil {
			return nil, err
		}
	}

	return resp, nil
}
1085077
func (s *Stepper) Do(f func(Path)) *Stepper {
	s.fs = append(s.fs, f)
	return s
}
893873
func (r Request) Do() (Response, error) {
	client := &http.Client{}
	client.Timeout = r.Timeout
	res, err := client.Do(r.Req)
	return Response{res, r.URI}, err
}
772758
func (c *Client) do(req *http.Request, v interface{}) error {
	res, err := c.httpClient.Do(req)

	if err != nil {
		return err
	}
	defer res.Body.Close()

	resBody, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return err
	}

	// Successful response
	if res.StatusCode == 200 {
		return json.Unmarshal(resBody, v)
	}

	// Attempt to unmarshal into Plaid error format
	var plaidErr Error
	if err = json.Unmarshal(resBody, &plaidErr); err != nil {
		return err
	}
	plaidErr.StatusCode = res.StatusCode
	return plaidErr
}
288769
func (s *sysSocket) do(f func()) error {
	// All operations handled by this function are assumed to only
	// read from s.done.
	s.mu.RLock()
	defer s.mu.RUnlock()

	if s.closed {
		return syscall.EBADF
	}

	s.g.run(f)
	return nil
}
1268831
func (c *client) do(method, resource string, payload map[string]string, authNeeded bool) (response []byte, err error) {
	respCh := make(chan []byte)
	errCh := make(chan error)
	<-c.throttle
	go c.makeReq(method, resource, payload, authNeeded, respCh, errCh)
	response = <-respCh
	err = <-errCh
	return
}
1257197
func (owe *ReturnError) Do(f func() error) error {
	owe.once.Do(func() {
		owe.err = f()
	})
	return owe.err
}
658133
func (s *PutTemplateService) Do() (*PutTemplateResponse, error) {
	// Check pre-conditions
	if err := s.Validate(); err != nil {
		return nil, err
	}

	// Get URL for request
	path, params, err := s.buildURL()
	if err != nil {
		return nil, err
	}

	// Setup HTTP request body
	var body interface{}
	if s.bodyJson != nil {
		body = s.bodyJson
	} else {
		body = s.bodyString
	}

	// Get HTTP response
	res, err := s.client.PerformRequest("PUT", path, params, body)
	if err != nil {
		return nil, err
	}

	// Return operation response
	ret := new(PutTemplateResponse)
	if err := json.Unmarshal(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
816304
func (c *Client) Do(req *http.Request) (*http.Response, error) {
	err := Sign(c.auth, req)
	if err != nil {
		return nil, err
	}

	return c.client.Do(req)
}
1122308
func (c *Client) Do(req *http.Request) (*http.Response, error) {
	req.Header = c.ExtraHeadersFor(req)

	return c.do(req, "", nil)
}
1039164
func (c *Client) Do(r *http.Request, v interface{}) error {
	var res *http.Response
	var err error
	if c.Client == nil {
		res, err = defaultHttpClient.Do(r)
	} else {
		res, err = c.Client.Do(r)
	}
	if err != nil {
		return err
	}
	defer res.Body.Close()
	if res.StatusCode >= 400 {
		if c.ErrorParser != nil {
			return c.ErrorParser(res)
		}
		return DefaultErrorParser(res)
	}

	resBody, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return err
	}
	if v == nil || res.StatusCode == http.StatusNoContent {
		return nil
	} else {
		return json.Unmarshal(resBody, v)
	}
}
17019
func (c *baseClient) Do(args ...interface{}) *Cmd {
	cmd := NewCmd(args...)
	_ = c.Process(cmd)
	return cmd
}
181496
func Do(args ...interface{}) Term {
	newArgs := []interface{}{}
	newArgs = append(newArgs, funcWrap(args[len(args)-1]))
	newArgs = append(newArgs, args[:len(args)-1]...)

	return constructRootTerm("Do", p.Term_FUNCALL, newArgs, map[string]interface{}{})
}
1229751
func (re *JSRE) Do(fn func(*otto.Otto)) {
	done := make(chan bool)
	req := &evalReq{fn, done}
	re.evalQueue <- req
	<-done
}
1268709
func (s *AliasService) Do(ctx context.Context) (*AliasResult, error) {
	path, params, err := s.buildURL()
	if err != nil {
		return nil, err
	}

	// Body with actions
	body := make(map[string]interface{})
	var actions []interface{}
	for _, action := range s.actions {
		src, err := action.Source()
		if err != nil {
			return nil, err
		}
		actions = append(actions, src)
	}
	body["actions"] = actions

	// Get response
	res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
		Method: "POST",
		Path:   path,
		Params: params,
		Body:   body,
	})
	if err != nil {
		return nil, err
	}

	// Return results
	ret := new(AliasResult)
	if err := s.client.decoder.Decode(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
1258959
func (o *Once) Do(fn ...func()) bool {
	if !atomic.CompareAndSwapUint32((*uint32)(o), 0, 1) {
		return false
	}
	for _, f := range fn {
		if f != nil {
			f()
		}
	}
	return true
}