Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Process.setPriority()

May I suggest one routine, and some constants to go with it:

public int setPriority(int priority) { /* ... */ }
public final int PRIORITY_HIGHEST = 2;
public final int PRIORITY_ABOVENORMAL = 1;
public final int PRIORITY_NORMAL = 0;
public final int PRIORITY_BELOWNORMAL = -1;
public final int PRIORITY_LOWEST = -2;

(inspired by C# Thread.Priority property)
Not sure about the values (positive and negative) but having constants would be nice (no pun intended).

> -----Original Message-----
> From: Chris McKillop [mailto:cdm@xxxxxxx] 
> Sent: Tuesday, January 28, 2003 1:14 AM
> To: cdt-dev@xxxxxxxxxxx
> Subject: Re: [cdt-dev] Process.setPriority()
> 
> 
> On Mon, Jan 27, 2003 at 09:30:49AM -0800, Chris Songer wrote:
> > Hi!
> > 
> > I think you want both a relative and absolute actually. For 
> the fellow who 
> > wants to do something platform specific you let them pass 
> in a raw priority 
> > number. You also do what you suggest and have win32 like 
> settings, Low, 
> > BelowNormal, Normal, AboveNormal and High. If you just do 
> the latter then 
> > you've hosed the fellow who really needs control for some reason.
> > 
> 
> Actually, I was thinking more like this...
> 
> .setPriority( int val );
> .setRelativePriority( int delta );
> 
> 
> Then you have complete control, but without having to worry 
> about figuring
> out what the priority of the caller's process actually might be.
> 
> So, to emulate nice you could do...
> 
> .setRelativePriority( -1 );
> 
> ...but to be totally system specific...
> 
> .setPriority( 9 );
> 
> Just make sure to put a nice warning on the .setPriority() 
> value that it's
> meaning is system dependant and that (more) portable code 
> should use relative
> priorities. ;)
> 
>     chris
> 
> -- 
>   Chris McKillop <cdm@xxxxxxx>   "The faster I go, the 
> behinder I get."
>   Software Engineer, QSSL                   -- Lewis Carroll --
>   http://qnx.wox.org/
> 
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/cdt-dev
> 


Back to the top