问题标签 [mono-embedding]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
10 浏览

mono-embedding - `mono_thread_attach` 是否需要通过其函数指针调用委托?

我们将 Mono 嵌入到 Python 中。Python 接收一些指向 CLR 委托的指针,这些指针是使用Marshal.GetFunctionPointerForDelegate(委托保持活动状态)获得的。Python 代码可能会在 Python 中创建新线程,在那里传递函数指针并使用它来调用我们的委托。根据https://www.mono-project.com/docs/advanced/embedding/#threading-issues,嵌入主机必须调用mono_thread_attach“在操作任何托管对象之前”。这是否适用于创建的 thunk GetFunctionPointerForDelegate?例如,我们是否需要注册新的 Python 线程,然后它才能通过在另一个线程中创建的指针调用我们的委托?