diff --git a/src/CoreFoundation/Dispatch.cs b/src/CoreFoundation/Dispatch.cs index e53a3aa320..c10e456ba1 100644 --- a/src/CoreFoundation/Dispatch.cs +++ b/src/CoreFoundation/Dispatch.cs @@ -265,34 +265,16 @@ namespace CoreFoundation { return new DispatchQueue (dispatch_get_global_queue ((nint) (int) DispatchQueuePriority.Default, 0), false); } } -#if MONOMAC - static DispatchQueue PInvokeDispatchGetMainQueue () - { - return new DispatchQueue (dispatch_get_main_queue (), false); - } -#endif static IntPtr main_q; - static object lockobj = new object (); public static DispatchQueue MainQueue { get { - lock (lockobj) { - if (main_q == IntPtr.Zero) { - // Try loading the symbol from our address space first, should work everywhere - main_q = Dlfcn.dlsym ((IntPtr) (-2), "_dispatch_main_q"); - - // Last case: this is technically not right for the simulator, as this path - // actually points to the MacOS library, not the one in the SDK. - if (main_q == IntPtr.Zero) - main_q = Dlfcn.GetIndirect (Libraries.System.Handle, "_dispatch_main_q"); - } + if (main_q == IntPtr.Zero) { + // Can't use a Field attribute because we don't support generating a call to Dlfcn.GetIndirect. + main_q = Dlfcn.GetIndirect (Libraries.libdispatch.Handle, "_dispatch_main_q"); } -#if MONOMAC - // For Snow Leopard - if (main_q == IntPtr.Zero) - return PInvokeDispatchGetMainQueue (); -#endif + return new DispatchQueue (main_q, false); } } @@ -427,12 +409,6 @@ namespace CoreFoundation { // dispatch_queue_t dispatch_get_global_queue (long priority, unsigned long flags); extern static IntPtr dispatch_get_global_queue (nint priority, nuint flags); -#if MONOMAC - [Obsoleted (PlatformName.MacOSX, 10, 7)] - [DllImport (Constants.libcLibrary)] - extern static IntPtr dispatch_get_main_queue (); -#endif - [DllImport (Constants.libcLibrary)] // this returns a "const char*" so we cannot make a string out of it since it will be freed (and crash) extern static IntPtr dispatch_queue_get_label (IntPtr queue); diff --git a/tests/xtro-sharpie/macOS-CoreFoundation.ignore b/tests/xtro-sharpie/macOS-CoreFoundation.ignore index cfdc17b303..4b7472403d 100644 --- a/tests/xtro-sharpie/macOS-CoreFoundation.ignore +++ b/tests/xtro-sharpie/macOS-CoreFoundation.ignore @@ -1,5 +1,4 @@ ## /usr/include/dispatch/queue.h -!unknown-pinvoke! dispatch_get_main_queue bound !unknown-pinvoke! dispatch_main bound ## dlfcn.h