Register a function to be called.
It is safe to call add-work from another thread.
The work function will be invoked in the thread-safe execution context of the endpoint.