Multiple independent embedded Python Interpreters on multiple operating system threads invoked from C/C++ program

陌路散爱 提交于 2019-11-28 06:52:00
Christian Aichinger

It's not exactly an answer to your question, but you could use separate processes instead of threads, then the problems should vanish.

Pros:

  • No need hacking python (and making sure the result works in all of the intended cases)
  • Probably less development effort overall
  • Easy upgrading to new python versions
  • Clearly defined interfaces between different processes, thus easier to get right and debug

Cons:

If you use shared memory for IPC, your resulting application code shouldn't differ too much from what you'd get with threads.

Given that some people are arguing you should always use processes over threads, I'd at least consider it as an alternative if it fits your constraints in any way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!