Fix MT locking, was not really right.
Merge pull request #3970 from unknownbrackets/gpu-thread

Fix MT locking, was not really right