V
vIndEx
Hi! I need to use more than five threads, each one with his own priority.
Thread.Priority only allows 5 different prioritys (XP prioritys), but
Windows CE
allows 256. So, I have to use this function (Windows API) to change the
priority:
BOOL SetThreadPriority(
HANDLE hThread,
int nPriority
);
Here is my first problem: I don't have the handler of the thread. To get it,
i think I have to use this function to create the thread:HANDLE
CreateThread(
SEC_ATTRS SecurityAttributes,
ULONG StackSize,
SEC_THREAD_START StartFunction,
PVOID ThreadParameter,
ULONG CreationFlags,
PULONG ThreadId
);
Parameters
SecurityAttributes [in] Pointer to a SEC_ATTRS structure that determines
whether the returned handle can be inherited by child processes. StackSize
[in] Specifies the initial commit size of the stack, in bytes. StartFunction
[in] Pointer to the application-defined function of type SEC_THREAD_START to
be executed by the thread. ThreadParameter [in] Pointer to a single
parameter value passed to the thread. CreationFlags [in] Specifies flags
that control the creation of the thread. ThreadId [out] Pointer to a
variable that receives the thread identifier.
Now my problem is the parameter STARTFUNCTION. It's a pointer to the method,
but I can't do this in .NET. I've tried passing it a delegate of the method,
but didn't work. Any idea?
Thanks for your help
Thread.Priority only allows 5 different prioritys (XP prioritys), but
Windows CE
allows 256. So, I have to use this function (Windows API) to change the
priority:
BOOL SetThreadPriority(
HANDLE hThread,
int nPriority
);
Here is my first problem: I don't have the handler of the thread. To get it,
i think I have to use this function to create the thread:HANDLE
CreateThread(
SEC_ATTRS SecurityAttributes,
ULONG StackSize,
SEC_THREAD_START StartFunction,
PVOID ThreadParameter,
ULONG CreationFlags,
PULONG ThreadId
);
Parameters
SecurityAttributes [in] Pointer to a SEC_ATTRS structure that determines
whether the returned handle can be inherited by child processes. StackSize
[in] Specifies the initial commit size of the stack, in bytes. StartFunction
[in] Pointer to the application-defined function of type SEC_THREAD_START to
be executed by the thread. ThreadParameter [in] Pointer to a single
parameter value passed to the thread. CreationFlags [in] Specifies flags
that control the creation of the thread. ThreadId [out] Pointer to a
variable that receives the thread identifier.
Now my problem is the parameter STARTFUNCTION. It's a pointer to the method,
but I can't do this in .NET. I've tried passing it a delegate of the method,
but didn't work. Any idea?
Thanks for your help