Re: Changing priority of threads from another application
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Tue, 2 May 2006 08:16:45 -0700
I believe that those handles are process-specific, and I'm not 100% sure
that just casting an ID to a handle is going to work, either, but even if it
does give the right value, I think that the value is specific to the process
the thread is running in. So, since you're in another process context and
your handle table doesn't include those thread handles, they look invalid to
the call.
I think that the right way to approach this problem is to adjust priorities
only of those items that you own. So, if the third-party applications are
eating too many cycles, increase the priority of your own threads and yield
enough to allow the other applications to do some work, but only as much as
you're willing to allow.
Paul T.
"Peter Stephens" <PeterStephens@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:85CC7AE9-66B5-4D0F-A0C6-3253E5C77B3C@xxxxxxxxxxxxxxxx
Hi All,
we are building an industrial controller and need to get the balance of
priorities on the controler right. We are running some applications that
are
from 3rd parties and don't have access to the source for these apps.
Unfortunately these apps are pretty greedy and are preventing the system
from
running correctly.
I would like to change the priority of one of these apps and all its
threads (it launches about 21 threads).
I thought I'd do this by geting the thread ID using the ToolHelp
Functions. I am able to get the THREADENTRY32 structures properly
populated
and can see the thread IDs.
Unfortunately when I try calling either
CeSetThreadPriority(myHandle, priToSet) or
SetThreadPriority(myHandle, priToSet)
where myHandle is set from the structure as follows
myHandle = (HANDLE)myTStruct.th32ThreadID;
I get an error code 6, meaning invalid handle. Am I doing something wrong
or is this not possible?
Are there any other ways to get a valid handle to threads to set their
priority from outside the process that created the thread?
Thanks for your help
.
- Follow-Ups:
- Re: Changing priority of threads from another application
- From: Peter Stephens
- Re: Changing priority of threads from another application
- Prev by Date: Re: How to Add Chinese support to WinCE 3.0 Image ????
- Next by Date: Re: failed dll loading
- Previous by thread: Re: How to Add Chinese support to WinCE 3.0 Image ????
- Next by thread: Re: Changing priority of threads from another application
- Index(es):
Relevant Pages
|