> I'm not certain that I understand your situation completely, but I
don't
> see any issues that wouldn't be handled by using BeginInvoke rather
than
> Invoke.  That will let both UI and process threads proceed without
waiting
> on the other.

I was implying that I would use BeginInvoke, so that each thread could
execute concurrently. My problem is that even if both threads are
executing concurrently, if they try and share resources for which there
might be some contention, then a resource could be locked, and one
thread could block while waiting for it. Meaning that I could block the
UI thread, which is something I'd like to avoid.

So my two considered solutions were to either:
A: Not rely on the shared resource for state, but rather pass state with
the event, or
B: Create a 'message pump', where I can queue event delegates and invoke
them once the worker thread has finished.

It may be the case that I don't need to worry about this, but then there
will be resource contention, and I'm not sure if this is a good idea.
Also, what if the state objects were not thread safe? Then I'd have to
use one of the methods left above, or risk using bogus data.

I'm still looking for an async MVC pattern for WinForms. Anyone know
anything about this?

Basically the Model contains state and throws events, and the Views
receive the events so they can update themselves in the UI. But the
Models state is changed on a worker thread, and the Views need to update
themselves on the UI thread. But the code on the UI thread that updates
the View can't ask for data from the Model while it is possible that the
model is being manipulated by a worker thread, because the worker thread
may have locked the Model causing the UI thread to block.

John.

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to