|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.Diagnostics.CodeAnalysis; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
using CoreFoundation; |
|
|
|
using Foundation; |
|
|
|
@ -13,7 +14,7 @@ internal class Interop |
|
|
|
internal static NativeHandle kCFRunLoopCommonModes = CFString.CreateNative("kCFRunLoopCommonModes"); |
|
|
|
|
|
|
|
[Flags] |
|
|
|
public enum CFOptionFlags : ulong |
|
|
|
internal enum CFOptionFlags : ulong |
|
|
|
{ |
|
|
|
kCFRunLoopBeforeSources = (1UL << 2), |
|
|
|
kCFRunLoopAfterWaiting = (1UL << 6), |
|
|
|
@ -21,27 +22,34 @@ internal class Interop |
|
|
|
} |
|
|
|
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.StdCall)] |
|
|
|
public delegate void CFRunLoopObserverCallback(IntPtr observer, CFOptionFlags activity); |
|
|
|
|
|
|
|
internal delegate void CFRunLoopObserverCallback(IntPtr observer, CFOptionFlags activity, IntPtr info); |
|
|
|
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.StdCall)] |
|
|
|
public delegate void CFRunLoopTimerCallback(IntPtr timer); |
|
|
|
internal delegate void CFRunLoopTimerCallback(IntPtr timer, IntPtr info); |
|
|
|
|
|
|
|
[DllImport(CoreFoundationLibrary)] |
|
|
|
internal static extern IntPtr CFRunLoopGetMain(); |
|
|
|
|
|
|
|
[DllImport(CoreFoundationLibrary)] |
|
|
|
internal static extern IntPtr CFRunLoopObserverCreateWithHandler(IntPtr allocator, CFOptionFlags activities, bool repeats, int index, ref BlockLiteral block); |
|
|
|
internal static extern IntPtr CFRunLoopObserverCreate(IntPtr allocator, CFOptionFlags activities, |
|
|
|
bool repeats, int index, CFRunLoopObserverCallback callout, IntPtr context); |
|
|
|
|
|
|
|
[DllImport(CoreFoundationLibrary)] |
|
|
|
internal static extern IntPtr CFRunLoopAddObserver(IntPtr loop, IntPtr observer, IntPtr mode); |
|
|
|
|
|
|
|
[DllImport(CoreFoundationLibrary)] |
|
|
|
internal static extern IntPtr CFRunLoopTimerCreateWithHandler(IntPtr allocator, double firstDate, double interval, |
|
|
|
CFOptionFlags flags, int order, ref BlockLiteral block); |
|
|
|
internal static extern IntPtr CFRunLoopTimerCreate(IntPtr allocator, double firstDate, double interval, |
|
|
|
CFOptionFlags flags, int order, CFRunLoopTimerCallback callout, IntPtr context); |
|
|
|
|
|
|
|
[DllImport(CoreFoundationLibrary)] |
|
|
|
internal static extern void CFRunLoopTimerSetTolerance(IntPtr timer, double tolerance); |
|
|
|
|
|
|
|
[DllImport(CoreFoundationLibrary)] |
|
|
|
internal static extern void CFRunLoopTimerSetNextFireDate(IntPtr timer, double fireDate); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport(CoreFoundationLibrary)] |
|
|
|
internal static extern void CFRunLoopAddTimer(IntPtr loop, IntPtr timer, IntPtr mode); |
|
|
|
|
|
|
|
[DllImport(CoreFoundationLibrary)] |
|
|
|
internal static extern double CFAbsoluteTimeGetCurrent(); |
|
|
|
} |
|
|
|
|