.net - How to simulate Control.Invoke() in two NON-UI threads -
- suppose there's thread ui thread.
- thread creates thread b non ui thread.
- when thread b wants raise event in thread has if(form1.invokerequired) form1.invoke(same method) , call event within same method right?
simple. question if want same thing if both , b non-ui threads? theres no form object call invoke() thread b.
if winforms apps why isn't there mechanism non-ui threads? missing something? there similar method raise event in 1 non-ui thread non-ui thread?
thanks in advance.
p.s. producer/consumer model answers not ones i'm looking here.
in first scenario, since thread b knows isn't ui thread, might call .invoke(...)
.
when there 2 non-ui threads, going have use kind of message passing / queue. can't interrupt thread run work; must code thread (for example) check queue work, dequeue item , execute it. pretty winforms does, courtesy of windows message loop. doesn't matter if isn't answer you're looking - is.
Comments
Post a Comment