Click here to Skip to main content
15,896,154 members
Home / Discussions / C#
   

C#

 
GeneralRe: Writing to a List box in a dirrerent form... Pin
Furty24-Jul-03 15:01
Furty24-Jul-03 15:01 
GeneralRe: Writing to a List box in a dirrerent form... Pin
eggie524-Jul-03 18:39
eggie524-Jul-03 18:39 
GeneralRe: Writing to a List box in a dirrerent form... Pin
eggie524-Jul-03 18:41
eggie524-Jul-03 18:41 
GeneralRe: Writing to a List box in a dirrerent form... Pin
eggie525-Jul-03 17:05
eggie525-Jul-03 17:05 
QuestionHow can you tell if an element in a datagrid has the focus? Pin
work_to_live24-Jul-03 12:05
work_to_live24-Jul-03 12:05 
AnswerRe: How can you tell if an element in a datagrid has the focus? Pin
work_to_live24-Jul-03 13:31
work_to_live24-Jul-03 13:31 
General2 projects 1 class Pin
albean24-Jul-03 10:45
albean24-Jul-03 10:45 
GeneralRe: 2 projects 1 class Pin
David Stone24-Jul-03 10:51
sitebuilderDavid Stone24-Jul-03 10:51 
GeneralRe: 2 projects 1 class Pin
albean24-Jul-03 11:06
albean24-Jul-03 11:06 
GeneralRe: 2 projects 1 class Pin
Daniel Turini24-Jul-03 11:13
Daniel Turini24-Jul-03 11:13 
GeneralRe: 2 projects 1 class Pin
David Stone24-Jul-03 11:46
sitebuilderDavid Stone24-Jul-03 11:46 
GeneralRe: 2 projects 1 class Pin
albean25-Jul-03 9:19
albean25-Jul-03 9:19 
Generalaccessing controls through a collection Pin
Rbledwards24-Jul-03 10:44
Rbledwards24-Jul-03 10:44 
GeneralRe: accessing controls through a collection Pin
Furty24-Jul-03 15:15
Furty24-Jul-03 15:15 
GeneralRe: accessing controls through a collection Pin
LongRange.Shooter29-Jul-03 8:35
LongRange.Shooter29-Jul-03 8:35 
GeneralThread.Sleep is too slow Pin
eggie524-Jul-03 10:26
eggie524-Jul-03 10:26 
GeneralRe: Thread.Sleep is too slow Pin
albean24-Jul-03 10:30
albean24-Jul-03 10:30 
GeneralRe: Thread.Sleep is too slow Pin
eggie524-Jul-03 11:35
eggie524-Jul-03 11:35 
GeneralRe: Thread.Sleep is too slow Pin
albean24-Jul-03 14:26
albean24-Jul-03 14:26 
If you just want a short "delay" then you do not want to use Thread.Sleep. Because even a Thread.Sleep(0) causes a context switch and it may take "a long time" for the OS to hand control back to your program, depending on how many threads/tasks are scheduled.

Perhaps there is a way to inline some assembly in a C# app (I don't know about this though) and you could execute a no-op or something that would fill your requirements for a delay.

But you will still have that context switching problem since windows is preemptive multitasking. Consider this:


1 Executing code
2 Executing code
3 Your Delay
4 Executing code
5 Executing code

Even if there were some (atomic) delay statement that you could use at step 3 a context switch could take place between 3 and 4. This would make your delay appear to be even longer.


Good luck though, maybe there is a workaround.

GeneralRe: Thread.Sleep is too slow Pin
eggie524-Jul-03 17:36
eggie524-Jul-03 17:36 
GeneralRe: Thread.Sleep is too slow Pin
albean25-Jul-03 9:09
albean25-Jul-03 9:09 
GeneralRe: Thread.Sleep is too slow Pin
eggie525-Jul-03 16:54
eggie525-Jul-03 16:54 
GeneralRe: Thread.Sleep is too slow Pin
LongRange.Shooter25-Jul-03 10:39
LongRange.Shooter25-Jul-03 10:39 
GeneralRe: Thread.Sleep is too slow Pin
Daniel Turini24-Jul-03 11:15
Daniel Turini24-Jul-03 11:15 
GeneralRe: Thread.Sleep is too slow Pin
eggie524-Jul-03 11:33
eggie524-Jul-03 11:33 

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.