sleep

Interacting with IPhone while in sleep mode

I want my app to keep running and interacting with the user, even if the user presses the sleep button. So far I have learned, that my app can stay alive with the following code: NSTimer *timer = [NSTimer timerWithTimeInterval:0.5 target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] ad...

Avoid the iphone go into sleep mode.

Hi I have made an iphone fitness application. The issue i am unable to resolve here is that, while the application is running, the iphone goes in the sleep mode, and hence the accelerometer and sound turns off. Which i dont want to happen. Is there anyway i can avoid this from happening? If not that, atleast i could increase the time...

How can I create a sleep function in 16bit MASM Assembly x86?

I have been searching online for the last two hours and the only thing I have found that matches what I need does not seem to work. I am trying to create a sleep/delay procedure in 16bit MASM Assembly x86 that will, say, print a character on the screen every 500ms. From the research I have done, it seems that there are three methods to ...

Testing with Thread.sleep

What are the recommended approaches to using Thread.sleep() to speed up tests. I am testing a network library with a retry functionality when connections are dropped or timeout errors occur, etc. The library however, uses a Thread.sleep() between the retries (so it won't connect thousands times while the server is restarting). The cal...

Why would I use Sleep() with infinite timeout?

According to MSDN, Sleep() can be provided INFINITE value and that "indicates that the suspension should not time out". Why would I want to call Sleep() with INFINITE timeout in my program? ...

CMD: Sleep and hit any key, at the same time?

Hello, i have this batch file, which makes constantly a loop. I want the user to be able to terminate it in the batch, not just clicking the X. This is what i need (somehow): @echo off :proc cls rem All kind of stuff... echo Hit any key to terminate... sleep 1 @pause>nul But, of course, sleep and pause can't work at the same time. ...

Power Management API for auto-wake in OSX?

Hey, I need to write a program for OSX that will cause my macbook pro to wake up after a certain amount of time of sleeping. SleepX is almost perfect for me, but I want it to only go back to sleep if noone is moving the mouse/hitting the keyboard, etc.... I tried using the approach in the "wakeFromSleep" example in the Mac power manage...

Does the method System.currentTimeMillis() really return the current time?

Hi there! Based on ideas presented in link I implemented several different "sleep methods". One of this methods was the "binary sleep", which looks like this: while (System.currentTimeMillis() < nextTimeStamp) { sleepTime -= (sleepTime / 2); sleep(sleepTime); } Because the check if the next time step is already reached takes place at...

In there something similar to Java's Thread.yield() in Python? Does that even make sense?

I want to tell my Python threads to yield, and so avoid hogging the CPU unnecessarily. In Java, you could do that using the Thread.yield() function. I don't think there is something similar in Python, so I have been using time.sleep(t) where t = 0.00001. For t=0 there seems to be no effect. I think that maybe there is something I am not...

Upper limit in Python time.sleep()?

Is there an upper limit to how long you can specify a thread to sleep with time.sleep()? I have been having issues with sleeping my script for long periods (i.e., over 1k seconds). This issue has appeared on both Windows and Unix platforms. ...

Python freezes after computer sleep/hibernate

I have a python script that is running in the background with pythonw. If I close my laptop, it goes into sleep mode. and when I open my laptop, my program has little functionality and freezes after a couple of seconds. Is there any way that my script can tell if my computer is going into sleep mode, so that it can lie dormant and restar...

Dim iPhone Screen, but don't let it sleep

Happy Holidays! Alright, so here is my question. I have found by using Google (Hurray, GIYF) that I can disable the iPhone going to sleep in an application by using: application.idleTimerDisabled = YES; so the code looks like this: - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for c...

How do i wake a computer from being in sleep mode? in Vb 2008 expr edition

I'm trying to make an alarm clock. When the computer is in sleep mode, when the alarm is triggered i want the computer to wake up and play the alarm. Can tell me how to do this in vb 2008. ...

Multithreading python application hangs while running its threads.

I am trying to create a MainObject which is availible as a DBus service. This MainObject should always stay responsive to other objects/processes and for this non-blocking even while processing its items. for that reason items are processed in a seperate thread one after another (queue-style). You can add items to the MainObject via DBus...

How do you control the Apple MacBook "Sleep" light?

I would like to control the "sleep" light on a MacBook or iMac. That is, I want to be able to make it turn on, turn off, and pulsate. I am happy to do this in usermode or in kernel mode. I assume I'll need root. Any ideas? ...

When your web page can go to sleep

I have a web page, using jQuery and javaScript, and I would like to find out if and when to put the page to sleep. As a number of the tasks are background processes I need to put them to sleep if nothing is happening on the page. i.e. the user is working on another screen or not on his PC full stop ...

Java: Thread.currentThread().sleep(x) vs. Thread.sleep(x)

I have this in my code Thread.currentThread().sleep(x); Eclipse tells me to use the static Thread.sleep(x); instead, why? What's the difference, is there some difference in functionality at all between these 2 methods? ...

C# put pc to sleep or hibernate

Hi, I want to put my system to either sleep or hibernate, two different options. How would I do this with API's, I don't really want to use Process, and that doesn't allow me to choose what method I want for this action. Thanks. ...

Best way to slow down a thread? Is using Sleep() OK?

I've written a C++ library that does some seriously heavy CPU work (all of it math and calculations) and if left to its own devices, will easily consume 100% of all available CPU resources (it's also multithreaded to the number of available logical cores on the machine). As such, I have a callback inside the main calculation loop that s...

Clicking in Windows with delphi

I have a application that clicks on a flash game with the mouse, Locations of clicks are working fine its the actual clicking that is the issue, although this might be the flash that is to blame.. I have this code procedure move(x,y:byte); begin SetCursorPos(getx(x)+21,gety(y)+21); sleep(15); mouse_event(MOUSEEVENTF_LEFTDOWN, 0,...