Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
FartyMcFarter
on April 18, 2022
|
parent
|
context
|
favorite
| on:
The best engineering interview question I've ever ...
You don't need to see the rest of the codebase to realise that's probably wrong. In any codebase, locks only apply to the scope they're in.
jseban
on April 18, 2022
[–]
The key word here being "probably".
FartyMcFarter
on April 18, 2022
|
parent
[–]
Yes - so the safe thing to do is to put the lock outside the loop. Anyone experienced in multithreading will instinctively know this is the correct alternative for any codebase (and it performs better too).
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: