*struggles* Can't read code.. too many lines.. Uhhh..
Replace 'BREAK_MODULO' with checking if pid has changed when breaking lock for quicker lock breaking. Sleep 0.5 seconds instead of 1 second between lock attempts.