Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jordan <robertj@gmx.net>2007-08-23 10:17:06 +0400
committerRobert Jordan <robertj@gmx.net>2007-08-23 10:17:06 +0400
commitff0f205a0529cfa3e4bdcbeb6caf0d74231e4fbd (patch)
tree8d7ebbe0bda14be8d1d0c5cae99d8897132450e9 /mcs/class/System/System.Diagnostics/Process.cs
parent86e7dc6414a79d5c37f91ee3d16f10431fdfb3ef (diff)
2007-08-23 Robert Jordan <robertj@gmx.net>
* Process.cs: implement PriorityClass. Fixes #81756. svn path=/trunk/mcs/; revision=84679
Diffstat (limited to 'mcs/class/System/System.Diagnostics/Process.cs')
-rw-r--r--mcs/class/System/System.Diagnostics/Process.cs21
1 files changed, 19 insertions, 2 deletions
diff --git a/mcs/class/System/System.Diagnostics/Process.cs b/mcs/class/System/System.Diagnostics/Process.cs
index f312f49e8dc..8e1b3e569c0 100644
--- a/mcs/class/System/System.Diagnostics/Process.cs
+++ b/mcs/class/System/System.Diagnostics/Process.cs
@@ -480,17 +480,34 @@ namespace System.Diagnostics {
}
}
- [MonoTODO]
+ [MonoLimitation ("Under Unix, only root is allowed to raise the priority.")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The relative process priority.")]
public ProcessPriorityClass PriorityClass {
get {
- return(ProcessPriorityClass.Normal);
+ int error;
+ int prio = GetPriorityClass (process_handle, out error);
+ if (prio == 0)
+ throw new Win32Exception (error);
+ return (ProcessPriorityClass) prio;
}
set {
+ // LAMESPEC: not documented on MSDN for NET_1_1
+ if (!Enum.IsDefined (typeof (ProcessPriorityClass), value))
+ throw new InvalidEnumArgumentException ();
+
+ int error;
+ if (!SetPriorityClass (process_handle, (int) value, out error))
+ throw new Win32Exception (error);
}
}
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern int GetPriorityClass (IntPtr handle, out int error);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern bool SetPriorityClass (IntPtr handle, int priority, out int error);
+
[MonoTODO]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The amount of memory exclusively used by this process.")]