|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Worker Thread appears to deadlockI'm working on a project where I need to add an existing chat program as a
plugin. The framework I'm using requires that I write a Control that inherits from their own custom control. In the constructor for this control I start up the threads that listen to the server. After I start my second thread the program deadlocks, but currently the threads are not locking on anything. I have found that if I place a timer with an interval of 500 ticks, start the timer in the constructor, and begin the worker threads in the Tick event handler, the program works. Needless to say I'm not happy with the above solution. Is there something I need to watch out for before starting a background thread in a control? If so what event should I subscribe to? Thanks. How do you determine that the application is a dead lock situation?
Using the !SyncBlk (SOS) command you can identify the dead locks and trace of source for these locks. Are you touching any UI components from worker thread without using
Control.Invoke(), e.g. updating progress bar? If so it's destined to hang sooner or later. This issue is very familiar to Compact Framework developers as it would hang in pretty much 100% of the cases. Desktop developers usually ignore this as desktop only hangs from time to time. -- Show quoteBest regards, Ilya This posting is provided "AS IS" with no warranties, and confers no rights. *** Want to find answers instantly? Here's how... *** 1. Go to http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en 2. Type your question in the text box near "Search this group" button. 3. Hit "Search this group" button. 4. Read answer(s). "anonymous" <anonym***@discussions.microsoft.com> wrote in message news:C391CECF-890B-4F75-A66B-1E52C86F1970@microsoft.com... > I'm working on a project where I need to add an existing chat program as a > plugin. The framework I'm using requires that I write a Control that > inherits from their own custom control. In the constructor for this > control > I start up the threads that listen to the server. After I start my second > thread the program deadlocks, but currently the threads are not locking on > anything. I have found that if I place a timer with an interval of 500 > ticks, start the timer in the constructor, and begin the worker threads in > the Tick event handler, the program works. Needless to say I'm not happy > with the above solution. Is there something I need to watch out for > before > starting a background thread in a control? If so what event should I > subscribe to? > > Thanks. |
|||||||||||||||||||||||