octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #55185] KBHIT(1) should return immediately. It


From: Dave Goel
Subject: [Octave-bug-tracker] [bug #55185] KBHIT(1) should return immediately. It takes 8+ hours instead:
Date: Fri, 7 Dec 2018 22:27:22 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?55185>

                 Summary: KBHIT(1) should return immediately. It takes 8+
hours instead:
                 Project: GNU Octave
            Submitted by: deego
            Submitted on: Sat 08 Dec 2018 03:27:20 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: deego
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Your giant computation takes 30 days, so

(1) You want to plot the results intermittently, so you are stuck with using
the qt- toolkit.[1]

(2) If user presses "T", your running program wishes to detect the keypress,
and do certain actions [save work, terminate gracefully, etc.]

(3) Unfortunately, you occasionally do have to go home to shower during these
30 days, and for security, you have to allow the screensaver to lock the
screen when you go home. 

Your boss is strange and thinks that those are some pretty reasonable minimal
set of requirements your program should have. 
Here's a SSCCE that shows how kbhit(1) hangs forever when you try these
things:

(a) Debian Stable, self-compiled octave 4.22, xfce4.
(b) start octave --no-gui [which uses qt by default] and run the SSCCE below:
yyybug008. You start hearing a beep and see a plot after every intermediate
result.  Better yet, start several octave's.
(c) That's it. Congfigure xfce4 to lock monitor within 1 minute. Disable *all*
hibernating/sleeping. Indeed, your other scripts - including octave ones -
keep working during the monitor-sleep, confirming that your system was alive
and kicking all this time!
(d) Wait a minute and your screen locks. Almost immediately, you stop hearing
any beeps. Wait upto 1-5 minutes if you still hear them.
(e) Unlock the screen after the beeps stop or after you take that shower. Each
octave has errored out because it detected that kbhit(1) was hung instead of
returning immediately. I have seen hangs of 8 hours - or however long I leave
the screen locked. Thus, all work stops when the screen locks. :(



[1] If you use any other toolkit, then the plotted figure either doesn't show
till the end of 30 days, or if it does, it gets lost very easily: You alt-tab
or switch workspace, and you now have a blank figure. 








function  yyybug008();
  while true;
    for mmm=1:100;
      ig = __kbhitcheck;
    endfor
    plot(rand(1,2), rand(1,2));
    hold off;
    pause(2+rand());
    system("beep");
  endwhile
endfunction


function out = __kbhitcheck;
  ticcer=tic();
  out=kbhit(1);
  timetaken = toc(ticcer);
  if timetaken>1;
    error(sprintf("kbhit(1) should have taken negligible time, but took %f
seconds.", timetaken));
  endif
endfunction






    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55185>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]