changeset 17:084a1e7377a7

Locking up bug continues to cause trouble around mlWSGet.
author samer
date Sun, 05 Feb 2012 18:20:54 +0000
parents f2a0f5eaaaa5
children e0a1f92fcbc9
files cpp/plml.cpp prolog/plml.pl
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cpp/plml.cpp	Sun Feb 05 11:29:55 2012 +0000
+++ b/cpp/plml.cpp	Sun Feb 05 18:20:54 2012 +0000
@@ -580,10 +580,12 @@
 foreign_t mlWSGet(term_t var, term_t val) {
   try { 
     struct wsvar *x = term_to_wsvar(var);
-	 //printf(" - mlWSGET                 \r"); fflush(stdout); 
     mxArray *p = engGetVariable(x->engine, x->name);
-	 //printf("                           \r"); fflush(stdout); 
-    return PL_unify_blob(val, (void **)&p, sizeof(p), &mx_blob);
+	 if (p) return PL_unify_blob(val, (void **)&p, sizeof(p), &mx_blob);
+	 else {
+		 printf("\n!! mlWSGet: failed to get %s.\n",x->name);
+		 return raise_exception("mlWSGet: failed to get variable.");
+	 }
   } catch (PlException &e) { 
     return e.plThrow(); 
   }
--- a/prolog/plml.pl	Sun Feb 05 11:29:55 2012 +0000
+++ b/prolog/plml.pl	Sun Feb 05 18:20:54 2012 +0000
@@ -619,7 +619,8 @@
 
 % Most other conversions from ws(_) go via mx(_)
 convert_ws(T,Z,A) :- 
-	mlWSGET(Z,X), convert_mx(T,X,A).
+	mlWSGET(Z,X), 
+	convert_mx(T,X,A).
 
 
 %% convert_mx( +Type:type, +In:mx_blob, -Out:Type) is det.