Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Last active September 29, 2015 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolfbjarne/cabc229f931376b46188 to your computer and use it in GitHub Desktop.
Save rolfbjarne/cabc229f931376b46188 to your computer and use it in GitHub Desktop.
using System;
using System.Runtime.InteropServices;
using ObjCRuntime;
static class NSThreadExtensions {
[DllImport("/usr/lib/libobjc.dylib")]
static extern void objc_msgSend (IntPtr receiver, IntPtr selector, double thread);
[DllImport("/usr/lib/libobjc.dylib")]
static extern double double_objc_msgSend (IntPtr receiver, IntPtr selector);>
public static void SetPriority (this NSThread thread, double priority)
{
objc_msgSend (thread.Handle, Selector.GetHandle ("setThreadPriority:"), priority);
}
public static double GetPriority (this NSThread thread)
{
return double_objc_msgSend (thread.Handle, Selector.GetHandle ("threadPriority"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment