Synchronous task class

This class should allow tasks to be transferred across threads without
breaking anything. It's possible to block until task completion, and to
check if a task is pending, running or completed.