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
0 answers
Detecting when other apps are launched : Infinite loop in Android service
I need to implement app protector feature in which the user can block few apps and presented by a enter pass code screen when he starts any of blocked apps. For that I'm running a service which will detect the when other app is getting launched. I'm…

user1670443
- 461
- 2
- 6
- 17
1
vote
2 answers
Infinite loop in Apache Camel
I need to create a route, which periodically calls some process with a small delay between iterations.
When I look at documentation for looping:
The Loop allows for processing a message a number of times, possibly in a different way for each…

Peter
- 580
- 8
- 22
1
vote
0 answers
Infinite loop in Mac OS X "od -c" (and perhaps FreeBSD)
Try this on Mac OS X (don't worry, it won't crash your computer, it just spins):
printf "\314" | od -c
It seems that character 0314 somehow tricks od in its default Unicode mode (!) to look for further input, but there is none. I browsed the…

John Zwinck
- 239,568
- 38
- 324
- 436
1
vote
0 answers
AngularJS ng-repeat, $scope variable issue and preventing infinite $digest loop
I need to find a better solution regarding ng-repeat, $scope variable and infinite $digest loop. I'm sure it's not $watch issue and I'm sure it's in the way I'm updating my $scope variable.
The issue doesn't happen in Chrome. It only happens in…

devwannabe
- 3,160
- 8
- 42
- 79
1
vote
1 answer
Breadth first search in python stuck in infinite loop
I'm trying to implement breadth first search in python. I'm trying to find a path through a grid, starting from one square and finding a path towards the goal square. There are obstacles throughout the grid marked by the character 'o'. The "graph"…

Emma
- 35
- 2
- 11
1
vote
1 answer
Attempt at Box Translation Results in Hung Output?
I have been trying to animate a simple box that moves from left to right in the viewport while changing its color at random. It is meant to restart animating on a left mouse click, and close on a right mouse click. I have been debugging my code…

Rome_Leader
- 2,518
- 9
- 42
- 73
1
vote
0 answers
Infinite loop that reads stdin in JScript
I'm trying to create an infinite loop to poll for midi input. The loop I have here is technically infinite but I think what's happening is it's getting stuck on the WScript.StdIn.ReadLine() method. It seems that it waits each time for the user to…

Jpaji Rajnish
- 1,491
- 4
- 17
- 35
1
vote
1 answer
How to implement an infinite update loop in a functional way
I've got an internal state, which has to be updated continuously. Following functional programming, the state is immutable and the loop is implemented using recursion. An example way of how this could be implemented in a hypothetical (C based)…

Layl Conway
- 385
- 9
- 17
1
vote
2 answers
What am i doing wrong in this attempt at an infinite loop?
I'm trying to make a code for my python class and i'm making a wallet management system basic. but i cant get this infinite loop to work. What am i doing wrong?
def main():
# Initial balance
balance = input ('Wallet balance: ')
# This constructs…

MrSassyBritches
- 55
- 1
- 7
1
vote
2 answers
Infinite-while or for loop after ActionEvent not working in swing. why?
public void myMethod()
{
if (capture.isOpened()) {
while (true) { //This is The main issue.
capture.read(webcam_image);
if (!webcam_image.empty()) {
webcam_image = my_panel.detect(webcam_image);
temp =…

Gopal00005
- 2,061
- 4
- 35
- 54
1
vote
5 answers
Why doesn't scanf() wait for the next input if I previously entered a certain input
below is my simple code to enter a number and print it. it is inside a while(1) loop so i need to "Enter the number infinite number of time- each time it will print the number and again wait for the input".
#include
int main()
{
int…

mr.Cracker
- 211
- 3
- 14
1
vote
7 answers
C Program infinite loop unexpectedly when used scanf
I checked here and there and wasted around 3 hours checking for a solution. My program just infinite loop itself. Here is my C program:
#include
#include
int main (void)
{
int attempts = 0;
char password[10];
do
…

Amession
- 249
- 1
- 10
1
vote
3 answers
Why does this while loop cause an infinite loop?
public void calculate(int input) {
inputField.setText("" + input);
while (input >= 1) {
if (input % 2 == 0) {
input = input / 2;
} else {
input = (input * 3) + 1;
}
output.append("" + input);
}
}
The output…

Bytecode
- 47
- 6
1
vote
2 answers
Excel VBA: Looking for Advice Avoiding an Infinite Loop
Imgur Album with screens of worksheets: https://i.stack.imgur.com/raEfz.jpg
Long story short, I am writing an Excel VBA utility that will assign two types of security shifts (called coverages and weekend duties) to security staff members. …

Tom Winchester
- 387
- 2
- 7
- 22
1
vote
1 answer
Starting and stopping a thread by a button click
Simply, I have two classes, A GUI class which has a button both for stopping and running the other class/thread which is for getting the text content from clipboard and paste it to a text file. But no matter what I tried (such as using swingworker)…

user3868427
- 43
- 8