D
Dave A
I have a low priority background thread doing some async socket
communications.
The thread that kicks off the AsyncRead/AsyncWrite has its priority set to
'below normal'. But when the code enters the AsyncRead/AsyncWrite functions
I have discoved that the priority has been changed to 'normal'. I
understand that new threads in .Net do not inherit their creators priority
(which is cool) but what I can't understand is how to convince the
AyncRead/Write thread to be the priority of its creator.
The only thing I can think of is use some private class member to record the
creators priority when the class is created and then in the
AsyncRead/AsyncWrite to manually change the priority to the value in the
member - seems ugly to me.
/// <summary>
/// Sends the data asynchronously
/// </summary>
/// <param name="ar"></param>
private void SendAsync(IAsyncResult ar)
{
try
{
Thread.CurrentThread.Priority = this.originalThreadPriority;
...
Any suggestions?
Regards
Dave A
communications.
The thread that kicks off the AsyncRead/AsyncWrite has its priority set to
'below normal'. But when the code enters the AsyncRead/AsyncWrite functions
I have discoved that the priority has been changed to 'normal'. I
understand that new threads in .Net do not inherit their creators priority
(which is cool) but what I can't understand is how to convince the
AyncRead/Write thread to be the priority of its creator.
The only thing I can think of is use some private class member to record the
creators priority when the class is created and then in the
AsyncRead/AsyncWrite to manually change the priority to the value in the
member - seems ugly to me.
/// <summary>
/// Sends the data asynchronously
/// </summary>
/// <param name="ar"></param>
private void SendAsync(IAsyncResult ar)
{
try
{
Thread.CurrentThread.Priority = this.originalThreadPriority;
...
Any suggestions?
Regards
Dave A