tagged [sleep]

powershell mouse move does not prevent idle mode

powershell mouse move does not prevent idle mode ``` [System.Windows.Forms.Cursor]::Position = ` New-Object System.Drawing.Point($pos.X, ($pos.Y - 1)) [System.Windows.Forms.Cursor]::Position = ` N...

21 Dec at 22:19

How and when to use SLEEP() correctly in MySQL?

How and when to use SLEEP() correctly in MySQL? In relation to [my other question](https://stackoverflow.com/questions/4284162/calling-stored-procedure-sequentially-from-sql-file-and-php-fails-differe...

23 May at 11:55

SwitchToThread vs Sleep(1)

SwitchToThread vs Sleep(1) I'm wondering what's the actual difference between calling Thread.Sleep(1) and calling SwitchToThread (if we ignore that it's currently not exposed by the BCL). Joe Duffy me...

7 Feb at 18:42

Bash: infinite sleep (infinite blocking)

Bash: infinite sleep (infinite blocking) I use `startx` to start X which will evaluate my `.xinitrc`. In my `.xinitrc` I start my window manager using `/usr/bin/mywm`. Now, if I kill my WM (in order t...

13 Jan at 13:15

How do I add a delay in a JavaScript loop?

How do I add a delay in a JavaScript loop? I would like to add a delay/sleep inside a `while` loop: I tried it like this: ``` alert('hi'); for(var start = 1; start

3 Mar at 16:19

Sleep function Visual Basic

Sleep function Visual Basic Is there a simple sleep function in Visual Basic that doens't involve thread. Something similiar like there exists in: C: `sleep(1);` We also tried this code: ...but it did...

12 Mar at 02:6

Using Thread.Sleep() in a Windows Service

Using Thread.Sleep() in a Windows Service I'm writing a windows service that needs to sleep for long periods of time (15 hrs is the longest it will sleep, 30 mins is the shortest). I'm currently using...

How to keep a .NET console app running?

How to keep a .NET console app running? Consider a Console application that starts up some services in a separate thread. All it needs to do is wait for the user to press Ctrl+C to shut it down. Whic...

Why there is a Thread.Sleep(1) in .NET internal Hashtable?

Why there is a Thread.Sleep(1) in .NET internal Hashtable? Recently I was reading implementation of .NET [Hashtable](http://msdn.microsoft.com/en-us/library/system.collections.hashtable%28v=vs.110%29....

Thread.Sleep or Thread.Yield

Thread.Sleep or Thread.Yield I have a method that uses a background worker to poll a DLL for a status looking something like this: ``` var timeout = DateTime.Now.AddSeconds(3); while (System.Status !=...

18 Aug at 15:34

Using async to sleep in a thread without freezing

Using async to sleep in a thread without freezing So I a label here (""). When the button (button1) is clicked, the label text turns into "Test". After 2 seconds, the text is set back into "". I made ...

22 Dec at 17:48

What happens to timer in standby mode?

What happens to timer in standby mode? I'm using Timer from Timers namespace. What happens to timer when PC goes to sleep or hibernates? I have timer set to 6 hours delay. What will happen in those si...

13 Feb at 15:1

How to asynchronously wait for x seconds and execute something then?

How to asynchronously wait for x seconds and execute something then? I know there is [Thread.Sleep](http://msdn.microsoft.com/en-us/library/d00bd51t.aspx) and `System.Windows.Forms.Timer` and [Monitor...

2 Feb at 12:27

Is it always bad to use Thread.Sleep()?

Is it always bad to use Thread.Sleep()? I created an extension method for the the class `Random` which executes an `Action` (void delegate) at random times: ``` public static class RandomExtension { ...

10 Aug at 06:41

Compare using Thread.Sleep and Timer for delayed execution

Compare using Thread.Sleep and Timer for delayed execution I have a method which should be delayed from running for a specified amount of time. Should I use Or I had read some [articles](ht

What is the difference between Thread.Sleep(timeout) and ManualResetEvent.Wait(timeout)?

What is the difference between Thread.Sleep(timeout) and ManualResetEvent.Wait(timeout)? Both Thread.Sleep(timeout) and resetEvent.Wait(timeout) cause execution to pause for at least `timeout` millise...

What happens to my app when my Mac goes to sleep?

What happens to my app when my Mac goes to sleep? When Mac OS X goes to sleep, due to closing a laptop or selecting "Sleep" from the Apple menu, how does it suspend an executing process? I suppose non...

22 Sep at 19:24

How to make the script wait/sleep in a simple way in unity

How to make the script wait/sleep in a simple way in unity How can I put a sleep function between the `TextUI.text = ....`, to wait 3 seconds between each phrase?

10 Sep at 08:44

Using Thread.Sleep in Xamarin.Forms

Using Thread.Sleep in Xamarin.Forms I want to execute the following ``` MainPage = new ContentPage { Content = new StackLayout { Children = { new Button { Text = "Threa...

How to use a timer to wait?

How to use a timer to wait? I am trying to delay events in my method by using a timer, however i do not necessarily understand how to use a timer to wait. I set up my timer to be 2 seconds, but when i...

16 Oct at 08:24

Off screen rendering when laptop shuts screen down?

Off screen rendering when laptop shuts screen down? I have a lengthy number-crunching process which takes advantage of quite abit of OpenGL off-screen rendering. It all works well but when I leave it ...

C# Label Text Not Updating

C# Label Text Not Updating I have the following code: ``` private void button1_Click(object sender, EventArgs e) { var answer = MessageBox.Show( "Do you wish to submit checked items to the ACH b...

15 Apr at 18:10

How to create javascript delay function

How to create javascript delay function I have a javascript file, and in several places I want to add a small delay, so the script would reach that point, wait 3 seconds, and then continue with the re...

1 Jun at 14:47

How can I perform a short delay in C# without using sleep?

How can I perform a short delay in C# without using sleep? I'm incredibly new to programming, and I've been learning well enough so far, I think, but I still can't get a grasp around the idea of makin...

22 Aug at 05:34

How accurate is Thread.Sleep(TimeSpan)?

How accurate is Thread.Sleep(TimeSpan)? I've come across a unit test that is failing intermittently because the time elapsed isn't what I expect it to be. An example of what this test looks like is: `...

20 Aug at 03:45