QScriptEngine in a thread

  • Hi all,

    Is there any reason that a QScriptEngine could not be encapsulated and run (evaluated) in a thread?

    I am finding the scripts to be more than valuable with the only limitation being that my current implementation is foreground based making it tricky to evaluate more than one at a time.

    I am considering writing a thread host for my scripts with the ability to create a new thread and run the script in that thread with signals to notify when the script completes or throws an error.

    Any reason this should not work? Any considerations I'm missing? Obviously I need to thread protect some of my resources being used in the script and that is being done already for a number of reasons.

    Thanks in advance!

  • Lifetime Qt Champion


    I haven't used that class but from the looks of it, using the worker object approach should be fine.

Log in to reply