allow os.Signal to be specified and add an extra channel for cancellation

I need another way besides signals to control the shutdown of a server.
Additionally, I thought it would be best to explicitly terminate the goroutine
created in case srv.Server.Serve fails with an error. Examining http.go source
code that doesn't seem to happen, but I added the check just in case.

I would be happy if you could review the code and pull it in.
Thank you in advance.
Should be a struct{} chan, not int.