github.com/cybriq/giocore@v0.0.7-0.20210703034601-cfb9cb5f3900/app/internal/wm/os_darwin.m (about) 1 // SPDX-License-Identifier: Unlicense OR MIT 2 3 @import Dispatch; 4 @import Foundation; 5 6 #include "_cgo_export.h" 7 8 void gio_wakeupMainThread(void) { 9 dispatch_async(dispatch_get_main_queue(), ^{ 10 gio_dispatchMainFuncs(); 11 }); 12 } 13 14 bool gio_isMainThread() { 15 return [NSThread isMainThread]; 16 } 17 18 NSUInteger gio_nsstringLength(CFTypeRef cstr) { 19 NSString *str = (__bridge NSString *)cstr; 20 return [str length]; 21 } 22 23 void gio_nsstringGetCharacters(CFTypeRef cstr, unichar *chars, NSUInteger loc, NSUInteger length) { 24 NSString *str = (__bridge NSString *)cstr; 25 [str getCharacters:chars range:NSMakeRange(loc, length)]; 26 }