I need to let 5 readers per writer into the database if there's a writer waiting, otherwise, let every reader into the database
Debugging this is very difficult and every time I try anything, I end up with deadlocks everywhere.
Does anyone have a simple, pseudocode algorithm that does this?