-
-
Notifications
You must be signed in to change notification settings - Fork 645
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the course of playing with redbean I was confused about how the state was behaving and then noticed that some stuff is maybe getting edited by multiple processes. I tried to improve things by changing the definition of the counter variables to be explicitly atomic. Claude assures me that most modern Unixes support cross-process atomics, so I just went with it on that front. I also added some mutexes to the shared state to try to synchronize some other things that might get written or read from workers but couldn't be made atomic, mainly the rusage and time values. I could've probably been less granular and just had a global shared-state lock, but I opted to be fairly granular as a starting point. This also reorders the resetting of the lastmeltdown timespec before the SIGUSR2 signal is sent; hopefully this is okay.
- Loading branch information
Showing
1 changed file
with
67 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters