M
Maqsood Ahmed
Hello,
We have been experiencing a problem with AutoResentEvent class for past
2-3 months. It seems that it just stops at WaitOne and the thread
doesn't released from blocking state. We have been using the following
code for past 4 years, and It was working perfectly fine till Nov-Dec
last year. I suspect a security update had messed it up. Please have a
look at the following code.
[Please note that we are using .NET Framework 1.1 SP1 for development]
-----------------------------------
Thread 1:
--------
public void IRCSendQueue(XmlDocument doc, string ircdest,bool
bExpectAck)
{
lock(queueIRCSend)
{
queueIRCSend.Enqueue(new IRCSendStruct(doc,ircdest,bExpectAck));
}
ircSendSignal.Set();
}
Thread 2:
--------
protected void IRCSendingThread()
{
//Event Processing
IRCSendStruct ircSendStruct;
try
{
while(ircclient.Connected)
{
ircSendSignal.WaitOne();
while(queueIRCSend.Count > 0)
{
lock(queueIRCSend)
{
ircSendStruct = (IRCSendStruct)queueIRCSend.Dequeue();
}
//Process IRC Message
this.IRCSend((ircSendStruct.expectAck)?ircSendStruct.doc.DocumentElement
..SelectSingleNode(Nodes.SEQNUM).InnerText:null,
Utility.DecodeXml(ircSendStruct.doc),ircSendStruct.ircdest);
}
}
}
catch(ThreadAbortException)
{
Log("IRC Sending Thread: Thread Abort", LogEntryType.INFORMATION,
null);
}
}
-----------------------------------
I put in logging before and after Set and WaitOne, It Sets the
AutoResetEvent but WaitOne never returns.
Thanks in advance.
Regards,
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
We have been experiencing a problem with AutoResentEvent class for past
2-3 months. It seems that it just stops at WaitOne and the thread
doesn't released from blocking state. We have been using the following
code for past 4 years, and It was working perfectly fine till Nov-Dec
last year. I suspect a security update had messed it up. Please have a
look at the following code.
[Please note that we are using .NET Framework 1.1 SP1 for development]
-----------------------------------
Thread 1:
--------
public void IRCSendQueue(XmlDocument doc, string ircdest,bool
bExpectAck)
{
lock(queueIRCSend)
{
queueIRCSend.Enqueue(new IRCSendStruct(doc,ircdest,bExpectAck));
}
ircSendSignal.Set();
}
Thread 2:
--------
protected void IRCSendingThread()
{
//Event Processing
IRCSendStruct ircSendStruct;
try
{
while(ircclient.Connected)
{
ircSendSignal.WaitOne();
while(queueIRCSend.Count > 0)
{
lock(queueIRCSend)
{
ircSendStruct = (IRCSendStruct)queueIRCSend.Dequeue();
}
//Process IRC Message
this.IRCSend((ircSendStruct.expectAck)?ircSendStruct.doc.DocumentElement
..SelectSingleNode(Nodes.SEQNUM).InnerText:null,
Utility.DecodeXml(ircSendStruct.doc),ircSendStruct.ircdest);
}
}
}
catch(ThreadAbortException)
{
Log("IRC Sending Thread: Thread Abort", LogEntryType.INFORMATION,
null);
}
}
-----------------------------------
I put in logging before and after Set and WaitOne, It Sets the
AutoResetEvent but WaitOne never returns.
Thanks in advance.
Regards,
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net