Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne

rolfbjarne/NSThreadExtensions.cs Secret

Last active Sep 29, 2015
Embed
What would you like to do?
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