diff options
Diffstat (limited to 'src/ast.c')
-rw-r--r-- | src/ast.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1226,6 +1226,18 @@ void ast_resolve(Ast *self, AstCompilerContext *context) { throw(AST_ERR); } + /* + TODO: This could cause a deadlock if two different threads resolve the same expression at the same time + and self->parser is overwritten by one of the threads, and then if both of the threads try to + resolve another expression at the same time that this expression depends on, + then the same thread could get ownership of that expression (self->parser would be assigned to that thread) + or another thread steals it. + Then the other thread that had its self->parser stolen would be stuck in a recursive dependency + deadlock since in the above code, an error is only thrown if the parser belongs to the current thread. + A possible fix for this may be to add a check above that if any of the other thread has failed, + then this thread should fail as well. + */ + self->resolve_data.status = AST_RESOLVING; self->parser = context->parser; switch(self->type) { |