Hi, Thanks for correction. Main idea:- I am talking about a program running in normal mode, not in gdb mode(not using GDB). Suppose the expected output should come in 10 min. Now, i run that program. It is running for quite some time now, like say 1hr. Still no output. That code has some infinite loop like explained in previous mail. But i dont know details. Now, by some means (like attaching GDB & doing something) can i make sure that the program is just looping for condition-check ? To give a practical example, suppose i am checking some counter register of a PCI card. Withing 10-20 times checking, the register is updated with new value. This is some kind of event for application. Counter value is stored. Then this counter value is checked for further increments. Suppose in such situations, every 10-20 times checking results in one counter increment. But what if, no increment happens ? how to detect this ? My focus is not on the coding choices & other stuff. My focus is on how to detect such situations using any tools available ? Putting some log statements in loop, will cause it, to print no. of times. Even after some looping, the expected condition occurs, still messages are going to be printed. Regards, Yogeshwar On Fri, Nov 28, 2008 at 3:12 PM, Pranav Peshwe <pranavpeshwe@xxxxxxxxx> wrote: > On Fri, Nov 28, 2008 at 2:25 PM, yogeshwar sonawane <yogyas@xxxxxxxxx> > wrote: >> >> Hi all, >> Suppose, I have an application or library code containing following :- >> >> while (expected condition has not occurred) >> { >> handling of expected condition >> } > > If i'm not wrong, you mean 'while (expected condition has not occurred) ;' > (note the semicolon) > Otherwise, it does not make sense logically. > > IMHO, busy waiting like this would not be recommended in any app, and not at > all inside kernel code. > In case, there is absolutely no choice but to wait on a while(), the > simplest way to let the user know about the internal state of your > app/library is by having (a) log statement(s) inside the loop. > > HTH. CMIIW... > > Best regards, > Pranav > http://pranavsbrain.peshwe.com > > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ