Grokking Multithreading and Concurrency for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
Redundant mutex

Shlomi Fisher

Aug 10, 2024

Hi,

The occurrencesCount global variable seems redundant. Why not just use foundIndices.size()?

Even if we still want to keep using occurrencesCount, then localCount is redundant, since we can use localIndices.size() instead. This would make the countLock mutex redundant.

Best regard

1

0

Comments
Comments
Aldemar Hernández
Aldemar Hernández10 months ago

Totally agree. Also, I think localIndices is not necessary too.

On this page