//Start is called by concorde once the DOM is fully loaded.  Most of the
//application intialization code should be put in here.
490583
func (self *todoApp) Start() {

	//Setup an event handler for the primary input field. The called func
	//creates model instance and puts in the list of todos.
	// JQUERY: Any use of jquery is suspect as it allows many non type-safe operations.
	primaryInput.Dom().On(s5.CHANGE, func(event jquery.Event) {
		if !self.createTodo(primaryInput.Dom().Val()) {
			event.PreventDefault()
		}
	})

	//We need to attach the self.numNotDone string to the proper place
	//in the DOM.  Note that we use the lower-level jquery selector
	//(Select().Children())) plus NewTextAttr() we needed the string
	//child of span#todo-count (so we can't use HtmlId) and because
	//that object is directly in the HTML file.
	// JQUERY: Any use of jquery is suspect as it allows many non type-safe operations.
	selector := jquery.NewJQuery(todoCount.TagName() + "#" + todoCount.Id())
	todoCountSelect := selector.Children("strong")
	s5.Equality(s5.NewTextAttr(s5.WrapJQuery(todoCountSelect)), self.numNotDone)

	//We need to attach the self.plural string to the proper place
	//in the dom.
	s5.Equality(pluralSpan.TextAttribute(), self.plural)

	//These two calls attach the inverse of the empty attribute derived
	//from the model collection the display property (turning them on
	//when the list is not empty).  Note that we can't use the simpler
	//"Equality()" because we want to invert the value. The BooleanInverter
	//is a built in constraint function.
	sectionMain.DisplayAttribute().Attach(
		s5.NewBooleanInverter(self.todos.EmptyAttribute()))
	footer.DisplayAttribute().Attach(
		s5.NewBooleanInverter(self.todos.EmptyAttribute()))

	//This connects the display property of the clearCompleted to the boolean
	//that is true if some of the elements are done.  This effectively
	//turns on the button when there are some elements in the list and
	//some of those elements are done.
	s5.Equality(clearCompleted.DisplayAttribute(), self.someDone)

	//This connects the display in the button to the number of done
	//elements.  Note that this wont be visible if there are no
	//done elements.
	s5.Equality(numCompleted.TextAttribute(), self.numDone)

	//This is the event handler for click on the clearCompleted
	//dom element. We just walk the list of objects building a kill list,
	//then we destroy all the items in the kill list
	//JQUERY: Neither of the jquery params are used.
	clearCompleted.Dom().On(s5.CLICK, func(jquery.Event) {
		all := self.todos.All()
		if len(all) == 0 {
			return
		}
		dead := make([]s5.Model, len(all))
		ct := 0
		for _, model := range all {
			if model.(*todo).done.Value() {
				dead[ct] = model
				ct++
			}
		}
		for _, d := range dead {
			self.todos.Remove(d)
		}
	})

	//toggleAll's behavior is to toggle any items that are not already
	//marked done, unless they are all marked done in which they should all
	//be umarked
	//JQUERY: Neither of the jquery params are used.
	toggleAll.Dom().On(s5.CLICK, func(jquery.Event) {
		desired := true
		//Compare the output of the constraints to see if all are done
		if self.todos.LengthAttribute().Value() == self.numDone.Value() {
			desired = false
		}
		for _, m := range self.todos.All() {
			m.(*todo).done.Set(desired)
		}
	})

	//These are discussed below. These are constraints that depend
	//on *all* the values in the list.
	self.dependsOnAll()
}
839999
func (c context) start(wait time.Duration, delay time.Duration) error {
	procPaths, err := c.lookupProcessPaths()
	if err != nil {
		return err
	}

	if err := OpenAppDarwin(procPaths.appPath, c.log); err != nil {
		c.log.Warningf("Error opening app: %s", err)
	}

	// Check to make sure processes started
	c.log.Debugf("Checking processes: %#v", procPaths)
	serviceProcErr := c.checkProcess(procPaths.serviceProcPath, wait, delay)
	kbfsProcErr := c.checkProcess(procPaths.kbfsProcPath, wait, delay)
	appProcErr := c.checkProcess(procPaths.appProcPath, wait, delay)

	return util.CombineErrors(serviceProcErr, kbfsProcErr, appProcErr)
}
351642
func (s *Service) start() {
	for _, m := range s.modules {
		n := getModuleName(m)
		c := s.configs[n]
		BootPrintln("[service] starting", n)
		if c.Start != nil {
			c.Start()
		}
	}
	// mark as started
	s.started.Done()

	// mark process as running
	s.running.Add(1)

	// wait for a stop signal to be received
	// note: that c might crash without this parent goroutine knowing.
	s.wait()

	// mark process as done
	s.running.Done()
}
1057680
func (c *TasksCountCall) Start(start float64) *TasksCountCall {
	c.urlParams_.Set("start", fmt.Sprint(start))
	return c
}
1061485
func (it *invDatastoreIter) start(c context.Context, query *datastore.Query) {
	it.results = make(chan *Invocation)
	it.done = make(chan struct{})
	go func() {
		defer close(it.results)
		err := datastore.Run(c, query, func(obj *Invocation, cb datastore.CursorCB) error {
			select {
			case it.results <- obj:
				return nil
			case <-it.done:
				return datastore.Stop
			}
		})
		// Let 'next' and 'stop' know about the error. They look here if they
		// receive 'nil' from the results channel (which happens if it is closed).
		it.err = err
	}()
}
1199250
func (imu *IMUDriver) Start() (err error) {
	imu.connection.On("SysexResponse", func(res interface{}) {
		data := res.([]byte)
		imu.handleEvent(data)
	})
	return
}
1096000
func (s *Sessions) Start(ctx context.Context) *Session {
	cookieValue := s.decodeCookieValue(GetCookie(ctx, s.config.Cookie))

	if cookieValue == "" { // cookie doesn't exists, let's generate a session and add set a cookie
		sid := s.config.SessionIDGenerator()

		sess := s.provider.Init(sid, s.config.Expires)
		sess.isNew = s.provider.db.Len(sid) == 0

		s.updateCookie(ctx, sid, s.config.Expires)

		return sess
	}

	sess := s.provider.Read(cookieValue, s.config.Expires)

	return sess
}
1231738
func (s *Server) Start() error {
	if len(s.token) == 0 {
		return fmt.Errorf("token is empty")
	}
	updates, err := s.getUpdates()
	if err != nil {
		return err
	}
	for {
		select {
		case update := <-updates:
			handleUpdate := func(update *Update) {
				switch {
				case update.Message != nil:
					s.handleMessage(update.Message)
				case update.EditedMessage != nil:
					s.editMessageHandler(update.EditedMessage)
				case update.ChannelPost != nil:
					s.channelPostHandler(update.ChannelPost)
				case update.EditedChannelPost != nil:
					s.editChannelPostHandler(update.EditedChannelPost)
				case update.InlineQuery != nil:
					s.inlineQueryHandler(update.InlineQuery)
				case update.ChosenInlineResult != nil:
					s.inlineResultHandler(update.ChosenInlineResult)
				case update.CallbackQuery != nil:
					s.callbackHandler(update.CallbackQuery)
				case update.ShippingQuery != nil:
					s.shippingHandler(update.ShippingQuery)
				case update.PreCheckoutQuery != nil:
					s.preCheckoutHandler(update.PreCheckoutQuery)
				case update.Poll != nil:
					s.pollHandler(update.Poll)
				}
			}
			var f = handleUpdate
			for i := len(s.middlewares) - 1; i >= 0; i-- {
				f = s.middlewares[i](f)
			}
			go f(update)
		case <-s.stop:
			return nil
		}
	}
}
1337878
func (q *SQSDispatcher) Start(handle func(context.Context, *sqs.Message) error) {
	var wg sync.WaitGroup
	for i := 0; i < q.NumWorkers; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			q.start(handle)
		}()
	}

	wg.Wait()
}
1062071
func (s *session) start(ctx context.Context, description *api.NodeDescription) error {
	log.G(ctx).Debugf("(*session).start")

	errChan := make(chan error, 1)
	var (
		msg    *api.SessionMessage
		stream api.Dispatcher_SessionClient
		err    error
	)
	// Note: we don't defer cancellation of this context, because the
	// streaming RPC is used after this function returned. We only cancel
	// it in the timeout case to make sure the goroutine completes.

	// We also fork this context again from the `run` context, because on
	// `dispatcherRPCTimeout`, we want to cancel establishing a session and
	// return an error.  If we cancel the `run` context instead of forking,
	// then in `run` it's possible that we just terminate the function because
	// `ctx` is done and hence fail to propagate the timeout error to the agent.
	// If the error is not propogated to the agent, the agent will not close
	// the session or rebuild a new session.
	sessionCtx, cancelSession := context.WithCancel(ctx) // nolint: vet

	// Need to run Session in a goroutine since there's no way to set a
	// timeout for an individual Recv call in a stream.
	go func() {
		client := api.NewDispatcherClient(s.conn.ClientConn)

		stream, err = client.Session(sessionCtx, &api.SessionRequest{
			Description: description,
			SessionID:   s.sessionID,
		})
		if err != nil {
			errChan <- err
			return
		}

		msg, err = stream.Recv()
		errChan <- err
	}()

	select {
	case err := <-errChan:
		if err != nil {
			return err // nolint: vet
		}
	case <-time.After(dispatcherRPCTimeout):
		cancelSession()
		return errors.New("session initiation timed out")
	}

	s.sessionID = msg.SessionID
	s.session = stream

	return s.handleSessionMessage(ctx, msg)
}
80946
func (this *HttpClient) Begin() *HttpClient {
	this.lock.Lock()
	this.withLock = true

	return this
}
705316
func (p *Process) Start(ctx context.Context) error {
	r, err := p.t.shim.Start(ctx, &shim.StartRequest{
		ID: p.id,
	})
	if err != nil {
		return errdefs.FromGRPC(err)
	}
	p.t.events.Publish(ctx, runtime.TaskExecStartedEventTopic, &eventstypes.TaskExecStarted{
		ContainerID: p.t.id,
		Pid:         r.Pid,
		ExecID:      p.id,
	})
	return nil
}
218805
func (w *Window) begin() {
	if currWin != w {
		w.window.MakeContextCurrent()
		currWin = w
	}
}
1322831
func (s *Server) Start(ctx context.Context) (*net.TCPAddr, error) {
	return s.srv.Start(ctx, "devshell", s.Port, s.serve)
}
288366
func (d *L3GD20HDriver) Start() (err error) {
	if err := d.initialization(); err != nil {
		return err
	}
	return nil
}
306381
func (p *Project) Start(image string) (types.ContainerJSON, error) {
	return p.StartWithConfig(image, ContainerConfig{})
}
768832
func (s *Server) Start() error {
	if !atomic.CompareAndSwapUint32(&s.started, 0, 1) {
		return nil
	}

	s.wg.Add(1)
	go s.subscriptionHandler()

	return nil
}