changeset 8083:16ab78b816bc

variables.cc (mlock): lock current function
author John W. Eaton <jwe@octave.org>
date Wed, 03 Sep 2008 11:36:11 -0400
parents 163d20e4d39c
children 46aa04055325
files src/ChangeLog src/variables.cc
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Sep 03 11:20:25 2008 -0400
+++ b/src/ChangeLog	Wed Sep 03 11:36:11 2008 -0400
@@ -1,5 +1,8 @@
 2008-09-03  John W. Eaton  <jwe@octave.org>
 
+	* variables.cc (mlock): Lock current function on the call stack.
+	(Fmlock): Lock caller.
+
 	* symtab.cc (out_of_date_check_internal): If dispatch type is set,
 	check for method.  If that fails, check for regular function. 
 
--- a/src/variables.cc	Wed Sep 03 11:20:25 2008 -0400
+++ b/src/variables.cc	Wed Sep 03 11:36:11 2008 -0400
@@ -1888,7 +1888,7 @@
 void 
 mlock (void)
 {
-  octave_function *fcn = octave_call_stack::caller ();
+  octave_function *fcn = octave_call_stack::current ();
 
   if (fcn)
     fcn->lock ();
@@ -1938,7 +1938,14 @@
   octave_value_list retval;
 
   if (args.length () == 0)
-    mlock ();
+    {
+      octave_function *fcn = octave_call_stack::caller ();
+
+      if (fcn)
+	fcn->lock ();
+      else
+	error ("mlock: invalid use outside a function");
+    }
   else
     print_usage ();