cocoa: use a simpler threading model

Stop using libdispatch and move to a simple pthread recursive mutex. There is
a bit of flickering during resize, but at least the code is saner and should
not deadlock on weird edge cases.