Re: Invoking UI from woker thread.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

Thanks for your answer.

The delay here is to slow down the process because the script process must
send command (one by one) to an automate. Perhaps a 200 millisecons should do
the trick.

So you advise me to make a WaitAll of 0 milliseconds and manage the time in
the while loop ? Using tick or something else ?

You tell me to make the stop button set the stop event. But it is what I do
actually ?
private void m_Bt_Stop_Click(object sender, System.EventArgs e)
{
...
m_EventStopThread.Set();
...
}

I don't understand why should I implement a lock mechanism here ? Could you
give me more details on that ?

Best regards,
Martin

"not_a_commie" wrote:

Your main UI thread is stuck in a WaitAll for 10ms at a time, and the
delay may be longer depending on the CPU cores available, etc. You
should have your play button enabled and your stop button disabled
from inside your thread. Just make the stop button set the stop event.
And I don't really understand your delay stuff in the thread or your
DoEvents calls there. I would think you would just check the stop
event state (aka, use a timeout of 0) each time you passed through
your loop. And as far as those events go, performance wise you are
much better off using the Interlocked class or a common lock
mechanism. The ManualResetEvent is three orders of magnitude slower
than the lock keyword (Monitor class).

.



Relevant Pages

  • Re: interrupt latency and driver locking
    ... The MII calls usually have lots of DELAY() calls in them. ... >> lock but it might be worth investigating. ... the main problem, as i see it, is that when there are PHY events you ...
    (freebsd-arch)
  • Re: Possible circular locking dependency while running valgrind on an executable over CIFS
    ... But it would seem impractical to delay sending read requests from ... readpages - seems to defeat the whole purpose of having a higher ... drivers, various network file systems, some cluster file systems) ... running 2.6.25 with a few of the debug options enabled, including lock ...
    (Linux-Kernel)
  • Re: Headlight delay setting
    ... The one the REALLY got me on my 07 F150 was the auto door lock. ... auto unlock headlight delay and a bunch of other stuff are ... The seat belt buzzer drives you friggen' nuts. ...
    (rec.crafts.metalworking)
  • Re: [patch] increase spinlock-debug looping timeouts from 1 sec to 1 min
    ... Being on the edge of an NMI watchdog induced system crash ... Pretty much the only thing the loop condition ... I'm assuming that the additional delay in the debug code has worsened the ... I get that impression;) If it takes 1-2 seconds to get this lock then it ...
    (Linux-Kernel)