Hello,
I asked a question regarding thread synchronization on this usergroup
some days back. I was using the AutoResetEvent class for signalling
between two threads. The problem with AutoResetEvent was that it
sometimes it used to stop working a thread never come back from Wait
state.
I implemented Monitor for signalling following the suggestions came in
reply to that post. It started to getting worse and the application
started to hang (become irresponsive). I googled around and found that
there occurs a deadlock when Invoke is called on a control within the
Monitor lock. The alternatives were
i. Call the method (which is invoking the control) outside the lock
ii. Use BeginInvoke instead of Invoke.
both solutions were not feasible with current implementation of the
software, so we decided to device a custom signalling mechanism using
the Socket connections with the loopback address and writing and
reading a byte to Set and Wait respectively. This became even worse
and sometimes application as well as OS is hanged.
PC is Intel P4 2.67 with 2GB RAM. The user usually uses 9 to 10
instances of MS Excel, MS Outlook, Internet Explorer (several
instances) and some other applications.
Can anyone of you suggest what might be the cause of the problem? It
is a simple Producer/Consumer pattern, is it related to the PC
resource (GDI objects etc).
Regards
Maqsood Ahmed
Kolachi Advanced Technologies
http://www.kolachi.net