gmain: Use atomic logic to handle internal GSource flags

We use flags in both locked paths and in public ones (to check if a source is destroyed or running), but those checks are not using atomic logic, thus they lead to races in various tests.

Fix them by adding a new private flag (so that the public one can still be used as it used to, without having to use atomic APIs there) that is now used to atomically change and read the values.

And this fixes various tests in thread sanitizer

Helps with #3356

Edited by Marco Trevisan

Merge request reports

Loading