Harish Iyer

Harish Iyer

  • NA
  • 58
  • 0

Updating controls in a thread safe manner

Aug 4 2009 10:36 AM

Hello,
I have a thread intensive C# .NET application in which there are two main threads. I have just migrated this application from .NET 1.1 to .NET 2.0 framework. It works perfectly under .NET 1.1
Thread 1 - manages the state of the application.
Thread 2 - creates and updates the controls
In thread 2, the controls are being updated in a thread-safe manner using the Invoke calls since the trigger to update the controls may come from Thread 1. For some reason, the Invoke mechanism doesnt work. I have also tried using the BeginInvoke instead of Invoke, but it doesnt work. Due to this, the application hangs in the Thread 1 because Thread 2 does not update the control and return. It would be great if there is a solution to this issue!
 

Answers (3)