Branch: Tag:

2016-09-16

2016-09-16 09:20:14 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [master]: Improved thread-safety.

Protect against the same file being compiled concurrently in multiple
threads.

Fixes some more of [bug 7783].

1447:    }    }    +  object compiler_lock = DefaultCompilerEnvironment->lock(); +  if(!undefinedp(ret = programs[fname]) && (ret != no_value)) { +  destruct(compiler_lock); +  resolv_debug("low_findprog %s: returning cached (from other thread).\n", +  fname); +  return ret; +  }    resolv_debug ("low_findprog %s: compiling, mkobj: %O\n", fname, mkobj);    INC_RESOLV_MSG_DEPTH();    programs[fname]=ret=__empty_program(0, fname);
1469:    resolv_debug ("low_findprog %s: compilation failed\n", fname);    objects[ret] = no_value;    ret=programs[fname]=0; // Negative cache. +  destruct(compiler_lock);    throw(e);    } -  +  destruct(compiler_lock);    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: compilation ok\n", fname);    break;