An "infinite loop" is a loop in which the exit criteria are never satisfied; such a loop would perform a potentially infinite number of iterations of the loop body. The general problem of determining whether the execution of a loop with given preconditions will result in an infinite loop is undecidable; in other words, there is no algorithm to determine whether an execution of a loop will eventually terminate. This is known as the halting problem.
Questions tagged [infinite-loop]
3528 questions
1
vote
2 answers
shell script - complete iteration before exiting infinite loop
I am very new to shell scripting and need help in this.
I would like to run some commands with infinite loop and I want the loop to be terminated on ctrl-c is pressed, but before terminate I want current iteration to be completed (means all the…

Amit Chouksey
- 59
- 3
- 12
1
vote
1 answer
Getting infinite loop in fibonacci series in Python
#Program to print fibonacci until a range.
print "Fibonacci Series"
print "Enter a range"
range = raw_input()
first=1
second =1
print first
print ", "
print second
print ", "
third = 0
while(third < range):
third=first+second
print third
…

amulya349
- 1,210
- 2
- 17
- 26
1
vote
1 answer
Get new result in infinite loop with SqlAlchemy
I'm new to Python - coming from PHP - and have been bouncing back and forth between Python official documentation and SqlAlchemy (which I'm trying to use as easily as Laravel's DB class)
I have this bit of code:
from sqlalchemy import *
engine =…

egekhter
- 2,067
- 2
- 23
- 32
1
vote
5 answers
Infinite while loop with break statement
I am a beginner and I was analyzing this java code:
// t is a thread running
while (true) {
try {
t.join();
} catch (InterruptedException e) { e.printStackTrace(); }
break;
}
t=null;
What I am asking is: is there a need to put…

user3740494
- 21
- 3
1
vote
2 answers
How can I replace an infinite loop in Java with an executor?
Previously I had a thread with an infinite loop, constantly taking elements off a queue:
public void start() {
new Thread(task(), "Publish").start();
}
@SuppressWarnings("InfiniteLoopStatement")
private Runnable task() {
return () -> {
…

Graeme Moss
- 7,995
- 4
- 29
- 42
1
vote
1 answer
what can cause an infinite loop when using open? (C, UNIX)
I created a fifo using this: mkfifo("myfifo", 0666);
Now, I want to open it using inf fd = open("./myfifo",O_WRONLY); but that sends me to an infinite loop, why?

CIsForCookies
- 12,097
- 11
- 59
- 124
1
vote
1 answer
PHP Built-In Server Exiting with SIGSEGV / Wordpress
Developing a wordpress blog locally, my PHP server is dying with SIGSEGV half-way through rendering the page.
Here's my startup script: sudo php -S 127.0.0.1:80 -t ../reece-blog-local
I wish I could provide more details, but I can't seem to get any…

moon prism power
- 2,347
- 2
- 15
- 24
1
vote
2 answers
Create a certain triangle with stars
I'm using python IDE wing version 4.1
I'm trying to write a function with only 1 input which will be an integer and return the next shape of stars:
*
**
***
I tried using the following code but it gave another shape:
from math import *
from…

user3623371
- 21
- 3
1
vote
5 answers
split a list into two lists of odd-numbered entries and even -numbered entries
i'm using python 101 version 4.1
Example of input is (1,4,6,2,53,7)
Needed output is even(2,4,6) odd(1,7,53)
I need to use a function in this question with 1 input only which will be the list, i think a loop will help but i can't still get it. i…

user3623371
- 21
- 3
1
vote
1 answer
Going mad with infinite loop and RewriteCond, need help
I want to redirect users to my home page if they enter any URL not starting with 'en' or 'fr'. I've spent hours trying to make this work but this proves too tough for my fragile newbie brain. Currently, if I try to go…

Kerans
- 115
- 1
- 17
1
vote
2 answers
QWidget's paintEvent() lagging application
i'm studying and modifying the fridge magnets example, and the last thing I've tried to do was to draw a few labels and lines that are supposed to be on the background.
After looking around trying to figure out how to draw the labels and lines, I…

liewl
- 4,021
- 13
- 46
- 65
1
vote
1 answer
htaccess and GEOIP infinite loop
I wrote this in my htaccess:
GeoIPEnable On
RewriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} PE
RewriteCond %{HTTP_HOST} myweb.com [NC]
RewriteCond %{HTTP_HOST} !es [NC]
RewriteCond %{REQUEST_URI} !^/es/ [NC]
RewriteRule ^(.*)$ /es/$1 [R,L]…

Luis
- 325
- 4
- 20
1
vote
1 answer
All redirects to infinite loop
I want to redirect all request except like .html .js .jpg etc... For example www.mydomain.com/products should go to /index.php?p=cats&s=cars but www.mydomain.com/myproduct.html should go to www.mydomain.com/index.php?p=prod&s=myprod
my all…

Yargicx
- 1,704
- 3
- 16
- 36
1
vote
1 answer
Using Session Variables in Google App Engine creates Infinite Redirect
I have an app that works on a local server. Proof can be found here: http://the-geographic-personality-project.org/inventoryapp/
I pushed the same files to Google App Engine at this domain (http://inventoryapplication.appspot.com/), and I get an…

lrthistlethwaite
- 494
- 2
- 6
- 23
1
vote
0 answers
SysTrayIcon and Recursive/loop function
I'm having a bad time trying to create a simple program that runs in the notification area using the SysTrayIcon
While I can insert the program and start it, I can't manage to Quit/Suspend it from the the tray icon, because my program is in loop…

f.rodrigues
- 3,499
- 6
- 26
- 62