Provide a synchronous registration and unregistration of services.

Some parts of repl require being able to disable a service and block
until it's disabled.  Provide this API.

Forward port from 2.0.