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

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

[Octave-bug-tracker] [bug #55943] pause() with no arguments returns imme


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #55943] pause() with no arguments returns immediately on Windows
Date: Fri, 29 Mar 2019 00:22:16 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36

Follow-up Comment #16, bug #55943 (project octave):

I have a suspicion about this bug. It's Windows specific, which means it may
be caused by the Windows specific section of code here:

https://hg.savannah.gnu.org/hgweb/octave/file/4388526646ef/libinterp/corefcn/sysdep.cc#l596

Now I don't really know how these functions work on Windows, but it looks to
me like in non-blocking mode, it's either returning a valid character or the
value 0 if no keys were pressed.

Can someone please test a patch on Windows that simply returns -1 instead of 0
in that ternary expression?

In the Unix section of code, the return value when no character is available
is 'EOF', which is defined to be -1 in stdio.h.

Meanwhile, in the new 'octave::sleep(inf)' section of code that was added in
Octave 5.1, 'octave::kbhit' is called in a loop, and any non-negative value,
including 0, breaks out of the loop. So that may explain why this returns
immediately on Windows.

https://hg.savannah.gnu.org/hgweb/octave/file/4388526646ef/libinterp/corefcn/utils.cc#l1295

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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