Run 'attach' and 'detach' as background Tasks

All operations are now async. Callers can 'cancel' a running
'task' and the process will be shutdown. Callers must remember
to call 'destroy' on a 'task' when they are finished with it.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>