Fix deadlock issue on OS X.