code: func (mtask *managedTask) waitEvent(stopWaiting <-chan struct{}) bool {
  	seelog.Debugf("Managed task [%s]: waiting for event for task", mtask.Arn)
  	select {
  	case acsTransition := <-mtask.acsMessages:
  		seelog.Debugf("Managed task [%s]: got acs event", mtask.Arn)
  		mtask.handleDesiredStatusChange(acsTransition.desiredStatus, acsTransition.seqnum)
  		return false
  	case dockerChange := <-mtask.dockerMessages:
  		seelog.Debugf("Managed task [%s]: got container [%s] event: [%s]",
  			mtask.Arn, dockerChange.container.Name, dockerChange.event.Status.String())
  		mtask.handleContainerChange(dockerChange)
  		return false
  	case resChange := <-mtask.resourceStateChangeEvent:
  		res := resChange.resource
  		seelog.Debugf("Managed task [%s]: got resource [%s] event: [%s]",
  			mtask.Arn, res.GetName(), res.StatusString(resChange.nextState))
  		mtask.handleResourceStateChange(resChange)
  		return false
  	case <-stopWaiting:
  		seelog.Debugf("Managed task [%s]: no longer waiting", mtask.Arn)
  		return true
  	}
  }
docs: // waitEvent waits for any event to occur. If an event occurs, the appropriate
  // handler is called. Generally the stopWaiting arg is the context's Done
  // channel. When the Done channel is signalled by the context, waitEvent will
  // return true.