From a2db124cc95274461a9c6546e0bde29c42ad605b Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 29 May 2016 22:46:04 -0400 Subject: More stuff. --- link_darwin.go | 23 ----------------------- link_darwin_amd64.go | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) delete mode 100644 link_darwin.go create mode 100644 link_darwin_amd64.go diff --git a/link_darwin.go b/link_darwin.go deleted file mode 100644 index 64221b0..0000000 --- a/link_darwin.go +++ /dev/null @@ -1,23 +0,0 @@ -// 13 december 2015 - -package ui - -// #cgo LDFLAGS: ${SRCDIR}/libui_darwin_amd64.a -framework Foundation -framework AppKit -lpthread -// /* (thanks to http://jorgen.tjer.no/post/2014/05/20/dt-rpath-ld-and-at-rpath-dyld/ for the @executable_path clarifiaction) */ -// #include -// #include -// extern void _CFRunLoopSetCurrent(CFRunLoopRef); -// extern pthread_t _CFMainPThread; -import "C" - -// OS X cares very deeply if we don't run on the very first thread the OS creates -// why? who knows. it's stupid and completely indefensible. let's use undocumented APIs to get around it. -// apple uses them too: http://www.opensource.apple.com/source/kext_tools/kext_tools-19.2/kextd_main.c?txt -// apple HAS SUGGESTED them too: http://lists.apple.com/archives/darwin-development/2002/Sep/msg00250.html -// gstreamer uses them too: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/sys/osxvideo/osxvideosink.m -func ensureMainThread() { - // TODO set to nil like the apple code? - C._CFRunLoopSetCurrent(C.CFRunLoopGetMain()) - // TODO is this part necessary? - C._CFMainPThread = C.pthread_self() -} diff --git a/link_darwin_amd64.go b/link_darwin_amd64.go new file mode 100644 index 0000000..64221b0 --- /dev/null +++ b/link_darwin_amd64.go @@ -0,0 +1,23 @@ +// 13 december 2015 + +package ui + +// #cgo LDFLAGS: ${SRCDIR}/libui_darwin_amd64.a -framework Foundation -framework AppKit -lpthread +// /* (thanks to http://jorgen.tjer.no/post/2014/05/20/dt-rpath-ld-and-at-rpath-dyld/ for the @executable_path clarifiaction) */ +// #include +// #include +// extern void _CFRunLoopSetCurrent(CFRunLoopRef); +// extern pthread_t _CFMainPThread; +import "C" + +// OS X cares very deeply if we don't run on the very first thread the OS creates +// why? who knows. it's stupid and completely indefensible. let's use undocumented APIs to get around it. +// apple uses them too: http://www.opensource.apple.com/source/kext_tools/kext_tools-19.2/kextd_main.c?txt +// apple HAS SUGGESTED them too: http://lists.apple.com/archives/darwin-development/2002/Sep/msg00250.html +// gstreamer uses them too: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/sys/osxvideo/osxvideosink.m +func ensureMainThread() { + // TODO set to nil like the apple code? + C._CFRunLoopSetCurrent(C.CFRunLoopGetMain()) + // TODO is this part necessary? + C._CFMainPThread = C.pthread_self() +} -- cgit v1.2.3