Function lock and octave call stack (Was: seg-fault for default branch on Mac OSX?)

Michael Goffioul michael.goffioul at gmail.com
Mon Sep 1 07:46:25 CDT 2008


On Mon, Sep 1, 2008 at 9:04 AM, Michael Goffioul
<michael.goffioul at gmail.com> wrote:
> Most probably due to a missing lock in FLTK backend
> code. Can you try if adding "mlock()" in __init_fltk__
> code in fltk_backend.cc does fix the problem? If yes,
> I'll propose a complete patch later today.

I was looking at solving that problem, but I found something
weird and I'm not sure how I'm supposed to tackle this.

I tried to add "mlock()" call in __init_fltk__ (in fltk_backend.cc),
but I still got a crash. When debugging, I noticed that the lock
was actually placed on "feval", instead of "__init_fltk__" (indeed,
__init_fltk__ is called through feval).

More precisely, in octave_call_stack::do_caller(), the call stack is
the following (when executing "backend('fltk')"):
cs[0] : NULL
cs[1] : backend
cs[2] : feval
cs[4] : __init_fltk__

curr_frame is 3, which means that do_caller() returns the "feval"
frame. So "feval" is locked, while I wanted to lock __init_fltk__.
The code for the latter looks like:

DEFUN (__init_fltk__, ...)
{
  if (...)
  {
    mlock ();
  }
}

Any hint?

Michael.


More information about the Octave-maintainers mailing list