cocoa: Put a mutex around GL_SwapBuffers.

Prevents deadlock when swapping two different GL contexts on two different
threads at the same time on macOS 10.14 ("Mojave").

Fixes Bugzilla #4278.
3 files changed