Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
GSdx: Improve GSJobQueue behaviour #1741
To be honest, I'm not 100% sure that it is 100% atomic/thread safe (disclaimer I'm far from an atomic expert). Some reading here http://preshing.com/20141024/my-multicore-talk-at-cppcon-2014/
empty() is potentially inaccurate because of the relaxed atomic. I think you have only the guarantee to have the value written by the current thread. And I don't know if lock/unlock mutex pattern protect enough.
It would require some testing to ensure there isn't any rare bug.
I've taken that into account:
So it should be thread-safe (or so I think - can never be too sure).
EDIT: Even if it's not relaxed, the queue might be updated after empty() returns a value, so the same logic will still apply.