Changeset: 2da6935164ce for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2da6935164ce
Modified Files:
        monetdb5/mal/mal.h
        monetdb5/mal/mal_module.c
        monetdb5/mal/mal_runtime.c
Branch: iot
Log Message:

Protect MAL procedures of being zapped
while still running.


diffs (42 lines):

diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -207,6 +207,7 @@ typedef struct MALBLK {
        int inlineProp;                         /* inline property */
        int unsafeProp;                         /* unsafe property */
 
+       int inuse;                                      /* reference count the 
number of active invocations */
        int errors;                                     /* left over errors */
        int typefixed;                          /* no undetermined instruction 
*/
        int flowfixed;                          /* all flow instructions are 
fixed */
diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c
--- a/monetdb5/mal/mal_module.c
+++ b/monetdb5/mal/mal_module.c
@@ -229,6 +229,8 @@ void deleteSymbol(Module scope, Symbol p
        InstrPtr sig;
        int t;
 
+       if( prg->def->inuse)
+               return; // still being used
        sig = getSignature(prg);
        if( getModuleId(sig) && getModuleId(sig)!= scope->name ){
                /* move the definition to the proper place */
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -61,6 +61,7 @@ runtimeProfileInit(Client cntxt, MalBlkP
        str q;
 
        MT_lock_set(&mal_delayLock);
+       mb->inuse ++;   // reference count the number of active invocations
        if ( QRYqueue == 0)
                QRYqueue = (QueryQueue) GDKzalloc( sizeof (struct QRYQUEUE) * 
(qsize= 256));
        else
@@ -101,6 +102,7 @@ runtimeProfileFinish(Client cntxt, MalBl
        (void) cntxt;
 
        MT_lock_set(&mal_delayLock);
+       mb->inuse --;   // reference count the number of active invocations
        for( i=j=0; i< qtop; i++)
        if ( QRYqueue[i].mb != mb)
                QRYqueue[j++] = QRYqueue[i];
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to