Revert "Revert "add mutexes for concurrent access to result-map and cache""

This reverts commit bdc27e8afb890cb733d728f9785c9627ce067e0b.