Click here to Skip to main content
15,949,686 members
Home / Discussions / C#
   

C#

 
GeneralRe: The order of controls in a groupbox Pin
Ajay.k_Singh8-Apr-08 4:27
Ajay.k_Singh8-Apr-08 4:27 
GeneralRe: The order of controls in a groupbox Pin
TheJudeDude8-Apr-08 4:35
TheJudeDude8-Apr-08 4:35 
GeneralRe: The order of controls in a groupbox Pin
Luc Pattyn8-Apr-08 6:05
sitebuilderLuc Pattyn8-Apr-08 6:05 
GeneralRe: The order of controls in a groupbox Pin
Thomas Stockwell8-Apr-08 4:36
professionalThomas Stockwell8-Apr-08 4:36 
GeneralRe: The order of controls in a groupbox Pin
TheJudeDude8-Apr-08 6:16
TheJudeDude8-Apr-08 6:16 
GeneralRe: The order of controls in a groupbox Pin
Ravenet8-Apr-08 16:05
Ravenet8-Apr-08 16:05 
GeneralRe: The order of controls in a groupbox Pin
TheJudeDude8-Apr-08 18:48
TheJudeDude8-Apr-08 18:48 
QuestionSystem.Threading.Thread.Sleep() not working Pin
aei_totten8-Apr-08 4:00
aei_totten8-Apr-08 4:00 
Hey I am trying to use System.Threading.Thread.Sleep() and I am not getting expected results.
I am trying to use it as a delay

turn RTS on<br />
System.Threading.Thread.Sleep(5);<br />
turn RTS off


I have an o-scope hooked to the RTS line and I would expect that the RTS should go on and off anytime over 5 milliseconds (due to windows timing issues), but I would not expect to see it take anytime less than 5 milliseconds.

However, I am seeing results anywhere from just under 1 millisecond up to 20 milliseconds. Again if it was just 4 milliseconds (because of the resolution, i thought maybe we could see something as long as it was greater than 4) to whatever, I would be fine with that, but it is returning in less than 4 milliseconds down to one millisecond even!

Just for giggles I set up this

<br />
Using System.Diagnostics;<br />
Using System.Threading;<br />
<br />
long startTime,finishTime,diff;<br />
float elapsed;<br />
<br />
for (int x = 1; x <=10 ; x++)<br />
{<br />
   startTime = Stopwatch.GetTimeStamp();<br />
   Thread.Sleep(x);<br />
   finishTime = Stopwatch.GetTimeStamp();<br />
   diff = finishTime - startTime; <br />
   elapsed = diff / 10000;    <br />
   Console.Write(x + " > " + elapsed + "ms > " + diff);<br />
}


And am seeing very similar (and stragne) results.

Confused | :confused:
Is this just a bug in the the sleep function or what? Is there another function that I can call instead? (Don't even think about writing that I should be polling---don't get me started--, I am working in an environment where milliseconds difference are noticable, polling would be such a time killer)

Thanks
Brandy
GeneralRe: System.Threading.Thread.Sleep() not working Pin
led mike8-Apr-08 4:56
led mike8-Apr-08 4:56 
GeneralRe: System.Threading.Thread.Sleep() not working Pin
ChrisKo8-Apr-08 5:00
ChrisKo8-Apr-08 5:00 
GeneralRe: System.Threading.Thread.Sleep() not working Pin
Luc Pattyn8-Apr-08 6:08
sitebuilderLuc Pattyn8-Apr-08 6:08 
GeneralRe: System.Threading.Thread.Sleep() not working Pin
Dave Kreskowiak8-Apr-08 5:25
mveDave Kreskowiak8-Apr-08 5:25 
GeneralRe: System.Threading.Thread.Sleep() not working Pin
Luc Pattyn8-Apr-08 6:10
sitebuilderLuc Pattyn8-Apr-08 6:10 
QuestionAccess Form from Class Pin
parth.p8-Apr-08 2:58
parth.p8-Apr-08 2:58 
GeneralRe: Access Form from Class Pin
buchstaben8-Apr-08 3:11
buchstaben8-Apr-08 3:11 
GeneralRe: Access Form from Class Pin
parth.p8-Apr-08 3:13
parth.p8-Apr-08 3:13 
GeneralRe: Access Form from Class Pin
carbon_golem8-Apr-08 3:20
carbon_golem8-Apr-08 3:20 
GeneralRe: Access Form from Class Pin
parth.p8-Apr-08 3:25
parth.p8-Apr-08 3:25 
GeneralRe: Access Form from Class Pin
carbon_golem8-Apr-08 3:35
carbon_golem8-Apr-08 3:35 
GeneralRe: Access Form from Class Pin
Gareth H8-Apr-08 4:22
Gareth H8-Apr-08 4:22 
GeneralRe: Access Form from Class Pin
Dave Kreskowiak8-Apr-08 5:19
mveDave Kreskowiak8-Apr-08 5:19 
GeneralRe: Access Form from Class Pin
carbon_golem8-Apr-08 16:56
carbon_golem8-Apr-08 16:56 
GeneralRe: Access Form from Class Pin
Dave Kreskowiak8-Apr-08 5:16
mveDave Kreskowiak8-Apr-08 5:16 
GeneralRe: Access Form from Class Pin
Gareth H8-Apr-08 5:38
Gareth H8-Apr-08 5:38 
QuestionAllow service to interact with Desktop Pin
ptr2void8-Apr-08 2:36
ptr2void8-Apr-08 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.