当前位置:网站首页>Node child processes and threads
Node child processes and threads
2022-06-25 12:35:00 【Velly_ zheng】
master.js file
const cp = require('child_process') // Control the scheduling of subprocesses
const child_process = cp.fork(__dirname + './child.js'); // Create child process , Parameters are child process entries js
child_process.send('haha'); // Send messages to child processes
child_process.on('message',(str) => {
console.log(str); // The main process receives messages sent by child processes
})
child.js file
process.on('message',(str) => { //process Is a global variable
console.log(str);
process.send('hehe'); // The child process sends messages to the main process
}) // The subprocess accepts the message
function node master.js Output haha The main process does not exit at this time
边栏推荐
- 刷入Magisk通用方法
- [data midrange] what is the oneid of the data midrange? Isn't the master data fragrant?
- Huikan source code -- Huikan app system secondary development source code sharing
- devsecops与devops的理解与建设
- Online blind box system development function introduction and some source code sharing
- 实现领域驱动设计 - 使用ABP框架 - 系列文章汇总
- Arm V7 coprocessor
- PHP numeric array sorting and associative array sorting
- MySQL common interview questions
- Mind mapping video
猜你喜欢

An easy-to-use seal design tool - (can be converted to ofd file)

What is the primordial universe

Dark horse shopping mall ---2 Distributed file storage fastdfs

Explanation of ideas and sharing of pre-processing procedures for 2021 US game D (with pre-processing data code)

Penetration tool environment -- use of cknife Chinese kitchen knife

Full nanny tutorial of Market Research Competition (experience sharing)

How to use SPSS to do grey correlation analysis? Quick grasp of hand-to-hand Teaching

Execution order of MySQL query statements join, on and where

The source code of the hottest online disk money making system in 2022 imitates Lanzou online disk / Chengtong online disk / sharing money making cloud disk system / online disk VIP Download System

Zhangxiaobai's road of penetration (IV) -- detailed explanation of XSS cross site script vulnerabilities
随机推荐
ECSHOP product attribute color specification size stock item No. automatic combination
Repair the error that ECSHOP background orders prompt insufficient inventory when adding goods. Please reselect
Recyclerview scrolls to the specified location
Full nanny tutorial of Market Research Competition (experience sharing)
Development with courtesy -- share the source code of the secondary development of the app system of the imitation shopping mall
2022 meisai e topic ideas sharing + translation
Penetration tool environment -- use of cknife Chinese kitchen knife
PHP replaces the key of a two-dimensional array with a specified element value
Découvrir gaussdb (pour redis): une comparaison complète avec Codis
2022 meisai topic C idea sharing + translation
What is principal component analysis? Dimension reduction of classical case analysis variables
R language uses ordinal or. The display function obtains the summary statistical information of the ordered logistic regression model (the odds ratio and its confidence interval corresponding to the v
Web project development process
Execution order of MySQL query statements join, on and where
Wechat forbids sharing
Heyangdao store management system -- share the development source code of heyangdao system
Mpai data science platform SVM support vector machine classification \ explanation of regression parameter adjustment
Why do we do autocorrelation analysis? Explain application scenarios and specific operations
Huile optimization system -- sharing of secondary development source code of huile optimization app system
[论]Learning Dynamic and Hierarchical Traffic Spatiotemporal Features with Transformer