3 ms·
My implementation is multithreaded and parallel (ie I have multiple cores). The way I handle this is to have the leader check if it's still the leader before it
by tubby12345 5y ago
My implementation is multithreaded and parallel (ie I have multiple cores). The way I handle this is to have the leader check if it's still the leader before it does anything. That flag (`iamtheleader`) is set and read behind a mutex. I guess there's a race condition (old leader initiates read right before rpc sets that leader has ceded) but I never hit it. I guess the right way to do it is that the rpc that handles ceding should kill other rpc threads but that seems fraught. I wonder if there's some kind of interrupt request handler type thing in threading models...