RE: [BLACKBOX] Long running command and Dialog.ShowStatus

From: null <">
Date: Tue, 08 Dec 2009 08:44:42 +0000

----boundary-LibPST-iamunique-428674056_-_-
Content-type: text/plain

the KeyboardWatcher thread has some precautions for a non-responsive window, which I don't fully understand. Maybe the logic of KeyboardWatcher needs some polishing ...

I am puzzled by the

        WinApi.Sleep(1)

MSDN says:

        A value of zero causes the thread to relinquish the remainder of its time
        slice to any other thread of equal priority that is ready to run. If there
        are no other threads of equal priority ready to run, the function returns
        immediately, and the thread continues execution.

[...]

Remarks

This function causes a thread to relinquish the remainder of its time slice and become unrunnable for an interval based on the value of dwMilliseconds. The system clock "ticks" at a constant rate. If dwMilliseconds is less than the resolution of the system clock, the thread may sleep for less than the specified length of time. If dwMilliseconds is greater than one tick but less than two, the wait can be anywhere between one and two ticks, and so on. To increase the accuracy of the sleep interval, call the timeGetDevCaps function to determine the supported minimum timer resolution and the timeBeginPeriod function to set the timer resolution to its minimum. Use caution when calling timeBeginPeriod, as frequent calls can significantly affect the system clock, system power usage, and the scheduler. If you call timeBeginPeriod, call it one time early in the application and be sure to call the timeEndPeriod function at the very end of the application.

After the sleep interval has passed, the thread is ready to run. If you specify 0 milliseconds, the thread will relinquish the remainder of its time slice but remain ready. Note that a ready thread is not guaranteed to run immediately. Consequently, the thread may not run until some time after the sleep interval elapses. For more information, see Scheduling Priorities.



See http://msdn.microsoft.com/en-us/library/ms686298(VS.85).aspx

--
  Bernhard 
> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy> Josef Templ
> Sent: Friday, December 04, 2009 12:35 PM
> To: BLACKBOX{([at]})nowhere.xy> Subject: Re: [BLACKBOX] Long running command and Dialog.ShowStatus
> 
> 
> > There is a second thread in the BB system that is used to 
> interrupt a
> > buggy loop.  I think it recognizes the break key.  This thread runs
> > every second or so.
> 
> 
> Indeed! Thanks for the hint.
> 
> By the way, it is Ctrl-Break 
> or for the germans Strg-Pause.
> 
> 
> - Josef
> 
> 
> ----
> To unsubscribe, send a message with body "SIGNOFF BLACKBOX" 
> to LISTSERV{([at]})nowhere.xy> 
----boundary-LibPST-iamunique-428674056_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIHRoZSBLZXlib2FyZFdhdGNoZXIgdGhyZWFkIGhh
cyBzb21lIHByZWNhdXRpb25zIGZvciBhIG5vbi1yZXNwb25zaXZlIHdpbmRvdywgd2hpY2ggSSBk
b24ndCBmdWxseSB1bmRlcnN0YW5kLiBNYXliZSB0aGUgbG9naWMgb2YgS2V5Ym9hcmRXYXRjaGVy
IG5lZWRzIHNvbWUgcG9saXNoaW5nIC4uLlxwYXINClxwYXINCkkgYW0gcHV6emxlZCBieSB0aGUg
XHBhcg0KXHBhcg0KXHRhYiBXaW5BcGkuU2xlZXAoMSlccGFyDQpccGFyDQpNU0ROIHNheXM6XHBh
cg0KXHBhcg0KXHRhYiBBIHZhbHVlIG9mIHplcm8gY2F1c2VzIHRoZSB0aHJlYWQgdG8gcmVsaW5x
dWlzaCB0aGUgcmVtYWluZGVyIG9mIGl0cyB0aW1lIFxwYXINClx0YWIgc2xpY2UgdG8gYW55IG90
aGVyIHRocmVhZCBvZiBlcXVhbCBwcmlvcml0eSB0aGF0IGlzIHJlYWR5IHRvIHJ1bi4gSWYgdGhl
cmUgXHB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yB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5
ICJTSUdOT0ZGIEJMQUNLQk9YIiBccGFyDQo+IHRvIExJU1RTRVJWQExJU1RTLk9CRVJPTi5DSFx9
fQBhcg0KPiBUbyB1bg==
----boundary-LibPST-iamunique-428674056_-_---
Received on Tue Dec 08 2009 - 09:44:42 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:39 UTC