Fix race condition for the shared evaluator when any active input handler is threaded.
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Cryville.Crtr {
|
||||
_vecsrcs[i] = vecsrc;
|
||||
_vecops[i] = new InputVectorOp(vecsrc);
|
||||
}
|
||||
_etor = ChartPlayer.etor;
|
||||
_etor = judge != null ? judge._etor : ChartPlayer.etor;
|
||||
_ruleset = ruleset;
|
||||
_judge = judge;
|
||||
foreach (var i in ruleset.inputs) {
|
||||
@@ -172,7 +172,6 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
}
|
||||
|
||||
readonly object _lock = new object();
|
||||
static readonly int _var_value = IdentifierManager.SharedInstance.Request("value");
|
||||
const int MAX_DEPTH = 15;
|
||||
const int MAX_DIMENSION = 3;
|
||||
@@ -228,7 +227,7 @@ namespace Cryville.Crtr {
|
||||
readonly Dictionary<ProxiedInputIdentifier, PropSrc> _vecs = new Dictionary<ProxiedInputIdentifier, PropSrc>();
|
||||
double? _lockTime = null;
|
||||
unsafe void OnInput(InputIdentifier id, InputVector vec) {
|
||||
lock (_lock) {
|
||||
lock (_etor) {
|
||||
InputProxyEntry proxy;
|
||||
if (_sproxies.TryGetValue(id.Source, out proxy)) {
|
||||
_etor.ContextCascadeInsert();
|
||||
@@ -258,10 +257,10 @@ namespace Cryville.Crtr {
|
||||
_etor.ContextCascadeInsert();
|
||||
bool newNullFlag = nullflag;
|
||||
if (!newNullFlag) {
|
||||
ChartPlayer.etor.Evaluate(_vecops[depth + 1], p.Value);
|
||||
_etor.Evaluate(_vecops[depth + 1], p.Value);
|
||||
newNullFlag = _vecsrcs[depth + 1].IsNull;
|
||||
if (newNullFlag) ChartPlayer.etor.ContextCascadeUpdate(_var_value, PropSrc.Null);
|
||||
else ChartPlayer.etor.ContextCascadeUpdate(_var_value, _vecsrcs[depth + 1]);
|
||||
if (newNullFlag) _etor.ContextCascadeUpdate(_var_value, PropSrc.Null);
|
||||
else _etor.ContextCascadeUpdate(_var_value, _vecsrcs[depth + 1]);
|
||||
}
|
||||
OnInput(id, p.Key, ft, tt, newNullFlag, depth + 1);
|
||||
_etor.ContextCascadeDiscard();
|
||||
|
Reference in New Issue
Block a user