Enhance StoppableTask to capture and return errors to the caller
Problem
As a part of supporting full sync, an abstraction called StoppableTask
was introduced to run one-off tasks asynchronously with the ability to be able to stop them on demand. The abstraction has a limitation in that the current implementation doesnt capture the result of the async task as that isn't required at present. However, if such a need does develop, the existing abstraction will need to be updated
Solution
- Update contract of
StopAndWait()
to return error - Atomically capture and record an error in the struct
simpleStoppableTask