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

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

[Octave-bug-tracker] [bug #49515] Octave aborts on exit under some condi


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #49515] Octave aborts on exit under some conditions with --eval CODE
Date: Thu, 3 Nov 2016 01:30:25 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0

Follow-up Comment #18, bug #49515 (project octave):

Here's the help for nanosleep:

"
nanosleep() suspends the execution of the calling thread until either at least
the time specified in *req has elapsed, or the delivery of a signal that
triggers the invocation of a handler in the calling thread or that terminates
the process.

If the call is interrupted by a signal handler, nanosleep() returns -1, sets
errno to EINTR, and writes the remaining time into the structure pointed to by
rem unless rem is NULL. The value of *rem can then be used to call nanosleep()
again and complete the specified pause (but see NOTES).
"

I assume that octave_nanosleep_wrapper is returning a -1:


void
octave_sleep (double seconds)
{
  if (seconds <= 0)
    return;

  double fraction = std::modf (seconds, &seconds);
  fraction = std::floor (fraction * 1000000000); // nanoseconds

  time_t sec = ((seconds > std::numeric_limits<time_t>::max ())
                ? std::numeric_limits<time_t>::max ()
                : static_cast<time_t> (seconds));

  struct timespec delay = { sec, static_cast<long> (fraction) };
  struct timespec remaining;
  octave_nanosleep_wrapper (&delay, &remaining);

  octave_quit ();
}



int
octave_nanosleep_wrapper (const struct timespec *requested,
                          struct timespec *remaining)
{
  return nanosleep (requested, remaining);
}


and something about this symbolic code is issuing a signal if not during
sleep, then just before and the signal is unhandled.

Perhaps the answer is to first check for any unhandled signals before going
into the sleep state.  Eh, but the while(true) achieves the same thing in the
long run.  The changeset is fine.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49515>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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