From 4878be02ada77abdce716c39a1d6e1711a21f969 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 13 May 2013 23:19:44 +0200 Subject: cocoa_common: remove pointless locking when using -fs When using --fs `vo_cocoa_fullscreen` was called from the primary thread. This occurred inside `vo_cocoa_config_window` which is scheduled for excution on the primary thread with libdispatch). All of this caused spam from NSRecursiveLock in standard output. --- video/out/cocoa_common.m | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'video') diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 4a6cfb6a93..988b03e38f 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -635,17 +635,22 @@ int vo_cocoa_check_events(struct vo *vo) void vo_cocoa_fullscreen(struct vo *vo) { - // This is the secondary thread, unlock since we are going to invoke a - // method synchronously on the GUI thread using Cocoa. - vo_cocoa_set_current_context(vo, false); + if (![NSThread isMainThread]) { + // This is the secondary thread, unlock since we are going to invoke a + // method synchronously on the GUI thread using Cocoa. + vo_cocoa_set_current_context(vo, false); + } struct vo_cocoa_state *s = vo->cocoa; [s->window performSelectorOnMainThread:@selector(fullscreen) withObject:nil waitUntilDone:YES]; - // Now lock again! - vo_cocoa_set_current_context(vo, true); + + if (![NSThread isMainThread]) { + // Now lock again! + vo_cocoa_set_current_context(vo, true); + } } int vo_cocoa_swap_interval(int enabled) -- cgit v1.2.3