问题描述
如果我制作了一个电子应用程序,我很难在谷歌上搜索我将如何进行多线程.会是网络工作者吗?
I am having a hard time googling how I would do multi-threading if I made an electron app. Would it be with web workers?
推荐答案
在渲染进程中你可以创建Web Workers,并且这些将在自己的线程中运行,但是 在这些 Web Workers 中将禁用节点集成 因为 Node 不是线程安全的.因此,如果您想在使用 Node 的单独线程中运行某些东西,那么您需要生成一个单独的进程,您可以使用 child_process.fork() 然后使用 send().
In the renderer process you can create Web Workers, and those will run in their own threads, however Node integration will be disabled in those Web Workers because Node isn't thread-safe. So if you want to run something in a separate thread that uses Node then you'll need to spawn a separate process, you can do so with child_process.fork() and then communicate with the new process using send().
这篇关于电子框架是否允许通过网络工作者进行多线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)