Make calling DispatchTask thread-safe.