Thread-safe result storing of tasks