[Mono-list] nice value

Jamil Geor jamil_geor@yahoo.co.nz
Mon, 25 Oct 2004 13:54:02 +1300


Hi,
	I don't know if this is the right way to do it but it seems to work.

using System.Runtime.InteropServices;

public class Resource {
	const string Library = "libc";
	
	[DllImport(Library)]
	private extern static int getpriority (int class, int id);

	[DllImport(Library)]
	private extern static int setpriority (int class, int id, int
priority);

	public static int GetPriority ()
	{
		return getpriority (0, 0);
	}

	public static int SetPriority (int priority)
	{
		return setpriority (0, 0, priority);
	}
}

public class Test {
	public static void Main (string [] args) 
	{
		
		System.Console.WriteLine (Resource.GetPriority ());
		Resource.SetPriority (3);
		System.Console.WriteLine (Resource.GetPriority ());
	}
}

On Mon, 2004-10-25 at 10:34 +1300, Rob Brown-Bayliss wrote:
> 
> Hi, how would I go about changing the nice value of an app I have
> written in mono from within the app it's self?  
>