Added abilty to wrap slow or blocking tasks in a promise

This commit adds a 'background' function that you can use to generate a promise
for a task that is slow and/or blocking.  It takes care of fulfilling or rejecting
the promise while running the function in a background thread.