Skip to content

InterruptScriptThread implementation #6

@manison

Description

@manison

I believe the implementation of InterruptScriptThread is not correct. In our application when the method is called it causes a deadlock. It's because the script engine hijacks our thread by setting its context (lethal SuspendThread/SetThreadContext/ResumeThread combination). This prevents our thread to clean-up safely. I think the script interruption is supposed to work in a cooperative way, as hinted in this FAQ:

InterruptScriptThread only instructs the script engine to stop executing code at the next opportunity. The call sets a flag that the script engine only checks when executing code.

and

IActiveScript::InterruptScriptThread will return E_INVALIDARG if an interrupt is already pending in the script thread (ie. waiting for the next statement to be executed)…

I think you should instruct the Ruby VM somehow to abort the execution at the next opportunity. If this is not possible (e.g. there is no API for it) then it would IMHO be better to indicate that the request is not supported (E_NOTIMPL) than fiddling with context of a thread you don't own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions