// Start tells driver to get ready to do work
511063
func (b *AccelerometerDriver) Start() (err error) {
	// subscribe to accelerometer notifications
	b.adaptor().Subscribe(accelerometerCharacteristic, func(data []byte, e error) {
		a := &RawAccelerometerData{X: 0, Y: 0, Z: 0}

		buf := bytes.NewBuffer(data)
		binary.Read(buf, binary.LittleEndian, &a.X)
		binary.Read(buf, binary.LittleEndian, &a.Y)
		binary.Read(buf, binary.LittleEndian, &a.Z)

		result := &AccelerometerData{
			X: float32(a.X) / 1000.0,
			Y: float32(a.Y) / 1000.0,
			Z: float32(a.Z) / 1000.0}

		b.Publish(b.Event(Accelerometer), result)
	})

	return
}
342541
func (s *Service) Start(ctx context.Context) error {
	return s.collectContainersAndDo(ctx, func(c *container.Container) error {
		if err := s.connectContainerToNetworks(ctx, c, false); err != nil {
			return err
		}
		return c.Start(ctx)
	})
}
763781
func (h *MPU6050Driver) Start() (err error) {
	if err := h.initialize(); err != nil {
		return err
	}

	return
}
1167157
func (config ManifoldConfig) start(context dependency.Context) (worker.Worker, error) {
	if err := config.Validate(); err != nil {
		return nil, errors.Trace(err)
	}

	var agent jujuagent.Agent
	if err := context.Get(config.AgentName, &agent); err != nil {
		return nil, errors.Trace(err)
	}

	var stTracker workerstate.StateTracker
	if err := context.Get(config.StateName, &stTracker); err != nil {
		return nil, errors.Trace(err)
	}
	statePool, err := stTracker.Use()
	if err != nil {
		return nil, errors.Trace(err)
	}

	agentConfig := agent.CurrentConfig()
	setStateServingInfo := func(info params.StateServingInfo) error {
		return agent.ChangeConfig(func(config jujuagent.ConfigSetter) error {
			config.SetStateServingInfo(info)
			return nil
		})
	}

	st := statePool.SystemState()
	addressWatcher, err := config.NewMachineAddressWatcher(st, agentConfig.Tag().Id())
	if err != nil {
		return nil, errors.Trace(err)
	}

	w := config.NewWorker(Config{
		AddressWatcher:         addressWatcher,
		StateServingInfoGetter: agentConfig,
		StateServingInfoSetter: setStateServingInfo,
		ControllerConfigGetter: st,
		APIHostPortsGetter:     st,
	})
	return common.NewCleanupWorker(w, func() { stTracker.Done() }), nil
}
151039
func (b *batchProducer) Start() error {
	b.runningMu.Lock()
	defer b.runningMu.Unlock()

	if b.running {
		return ErrAlreadyStarted
	}

	go b.run()

	// We want run to run in the background (in a goroutine) but we don’t want to return until that
	// goroutine has actually entered its main loop. So we read from this non-buffered channel, which
	// will block until run writes a value to it.
	<-b.start

	b.running = true

	return nil
}
24912
func (c *CouchDB) Start() error {
	p := ifrit.Invoke(c)

	select {
	case <-p.Ready():
		return nil
	case err := <-p.Wait():
		return err
	}
}
1191058
func (w *worker) start() {
	go func() {
		for job := range w.jobs {
			w.doJob(job)
		}
		w.wg.Done()
	}()
}
307964
func (p *process) Start(ctx context.Context) error {
	r, err := p.task.client.TaskService().Start(ctx, &tasks.StartRequest{
		ContainerID: p.task.id,
		ExecID:      p.id,
	})
	if err != nil {
		if p.io != nil {
			p.io.Cancel()
			p.io.Wait()
			p.io.Close()
		}
		return errdefs.FromGRPC(err)
	}
	p.pid = r.Pid
	return nil
}
14981
func (m *Driver) Start() error {
	go func() {
		for {
			packet, err := m.adaptor().ReadMAVLinkPacket()
			if err != nil {
				m.Publish(ErrorIOEvent, err)
				continue
			}
			m.Publish(PacketEvent, packet)
			message, err := packet.MAVLinkMessage()
			if err != nil {
				m.Publish(ErrorMAVLinkEvent, err)
				continue
			}
			m.Publish(MessageEvent, message)
			time.Sleep(m.interval)
		}
	}()
	return nil
}
1296009
func (g *Driver) Start() (err error) {
	bus := g.GetBusOrDefault(g.connector.GetSpiDefaultBus())
	chip := g.GetChipOrDefault(g.connector.GetSpiDefaultChip())
	mode := g.GetModeOrDefault(g.connector.GetSpiDefaultMode())
	bits := g.GetBitsOrDefault(g.connector.GetSpiDefaultBits())
	maxSpeed := g.GetSpeedOrDefault(g.connector.GetSpiDefaultMaxSpeed())

	g.connection, err = g.connector.GetSpiConnection(bus, chip, mode, bits, maxSpeed)
	if err != nil {
		return err
	}
	return nil
}
1001075
func (w *Worker) Start() {
	handlerInterrupted := false
	go func() {
		for taskAndStrategy := range w.HandlerInputChannel {
			result := taskAndStrategy.Strategy(w, taskAndStrategy.WorkerTask.Msg, taskAndStrategy.WorkerTask.Id())
		Loop:
			for !handlerInterrupted {
				timeout := time.NewTimer(5 * time.Second)
				select {
				case w.HandlerOutputChannel <- result:
					timeout.Stop()
					break Loop
				case <-timeout.C:
				}
			}
			handlerInterrupted = false
		}
	}()

	go func() {
		for taskAndStrategy := range w.InputChannel {
			taskAndStrategy.WorkerTask.Callee = w
			w.HandlerInputChannel <- taskAndStrategy
			timeout := time.NewTimer(w.TaskTimeout)
			select {
			case result := <-w.HandlerOutputChannel:
				{
					w.OutputChannel <- result
				}
			case <-timeout.C:
				{
					handlerInterrupted = true
					w.OutputChannel <- &TimedOutResult{taskAndStrategy.WorkerTask.Id()}
				}
			}
			timeout.Stop()
		}
	}()
}
1264820
func (s *SSD1306Driver) Start() (err error) {
	bus := s.GetBusOrDefault(s.connector.GetSpiDefaultBus())
	chip := s.GetChipOrDefault(s.connector.GetSpiDefaultChip())
	mode := s.GetModeOrDefault(s.connector.GetSpiDefaultMode())
	bits := s.GetBitsOrDefault(s.connector.GetSpiDefaultBits())
	maxSpeed := s.GetSpeedOrDefault(s.connector.GetSpiDefaultMaxSpeed())

	s.connection, err = s.connector.GetSpiConnection(bus, chip, mode, bits, maxSpeed)
	if err != nil {
		return err
	}
	s.ssd1306Init()
	return
}
389857
func (config ManifoldConfig) start(context dependency.Context) (worker.Worker, error) {
	if err := config.Validate(); err != nil {
		return nil, errors.Trace(err)
	}

	var stTracker workerstate.StateTracker
	if err := context.Get(config.StateName, &stTracker); err != nil {
		return nil, errors.Trace(err)
	}
	statePool, err := stTracker.Use()
	if err != nil {
		return nil, errors.Trace(err)
	}

	st := statePool.SystemState()
	w, err := config.NewWorker(Config{
		RestoreInfoWatcher: RestoreInfoWatcherShim{st},
	})
	if err != nil {
		stTracker.Done()
		return nil, errors.Trace(err)
	}
	return &cleanupWorker{
		RestoreStatusWorker: w,
		cleanup:             func() { stTracker.Done() },
	}, nil
}
1245979
func (task *UDPListenerTask) Start(wg *sync.WaitGroup) StopChan {
	return task.ExtendedStart(nil, wg)
}
906887
func (b *ButtonDriver) Start() (err error) {
	state := b.DefaultState
	go func() {
		for {
			newValue, err := b.connection.DigitalRead(b.Pin())
			if err != nil {
				b.Publish(Error, err)
			} else if newValue != state && newValue != -1 {
				state = newValue
				b.update(newValue)
			}
			select {
			case <-time.After(b.interval):
			case <-b.halt:
				return
			}
		}
	}()
	return
}
1305188
func (sim *simra) Start(driver Driver) {
	simlog.FuncIn()

	gl := peer.NewGLPeer()
	sc := peer.GetSpriteContainer()
	sc.Initialize(gl)
	sim.gl = gl
	sim.spritecontainer = sc
	sim.driver = driver
	gomo := peer.GetGomo()
	gomo.Initialize(sim.onGomoStart, sim.onGomoStop, sim.onUpdate)
	gomo.Start()

	simlog.FuncOut()
}
919068
func (b *IOPinDriver) Start() (err error) {
	_, err = b.ReadPinADConfig()
	if err != nil {
		return
	}
	_, err = b.ReadPinIOConfig()
	return
}