func ServeAndStopOnSignals(gss ...Stoppable) <-chan error {
	// Init channels, mutex and error
	c := make(chan error, 1)
	sigs := make(chan os.Signal, 1)
	var m = &sync.Mutex{}
	var errout error

	// Serve Servable objects
	for _, g := range gss {
		if s, ok := g.(Servable); ok {
			go func() {
				err := s.Serve()
				logger.Printf("ServeAndStopOnSignals: Serving stopped, err=%v", err)
				if err != nil {
					select {
					case sigs <- syscall.SIGABRT:
					default:
					}
					m.Lock()
					errout = err
					m.Unlock()
				}
			}()
		}
	}
	// Wait for signals on seperate goroutine
	go func() {
		stopOnSignalsChannel(sigs, gss...)
		// Check for error.
		var e error
		m.Lock()
		e = errout
		m.Unlock()
		c <- e
	}()
	return c
}
// ServeAndStopOnSignals starts Servable objects and waits for signals
ServeAndStopOnSignals starts Servable objects and waits for signals
// ServeAndStopOnSignals starts Servable objects and waits for signals
func ServeAndStopOnSignals(gss ...Stoppable) <-chan error {
	c := make(chan error, 1)
	sigs := make(chan os.Signal, 1)
	var m = &sync.Mutex{}
	var errout error
	for _, g := range gss {
		if s, ok := g.(Servable); ok {
			go func() {
				err := s.Serve()
				logger.Printf("ServeAndStopOnSignals: Serving stopped, err=%v", err)
				if err != nil {
					select {
					case sigs <- syscall.SIGABRT:
					default:
					}
					m.Lock()
					errout = err
					m.Unlock()
				}
			}()
		}
	}
	go func() {
		stopOnSignalsChannel(sigs, gss...)
		var e error
		m.Lock()
		e = errout
		m.Unlock()
		c <- e
	}()
	return c
}
func ServeAndStopOnSignals ( gss ... Stoppable ) <- chan error { c := make ( chan error , 1 ) sigs := make ( chan os . Signal , 1 ) var m = & sync . Mutex { } var errout error for _ , g := range gss { if s , ok := g . ( Servable ) ; ok { go func ( ) { err := s . Serve ( ) logger . Printf ( " " , err ) if err != nil { select { case sigs <- syscall . SIGABRT : default : } m . Lock ( ) errout = err m . Unlock ( ) } } ( ) } } go func ( ) { stopOnSignalsChannel ( sigs , gss ... ) var e error m . Lock ( ) e = errout m . Unlock ( ) c <- e } ( ) return c }
ServeAndStopOnSignals starts Servable objects and waits for signals
ServeAndStopOnSignals starts Servable objects and waits for signals
// Init channels, mutex and error // Serve Servable objects // Wait for signals on seperate goroutine // Check for error.