Multithreading – how do I make Perl threads without copying all variables?
•
Java
I have a Perl program that would be very useful to use some form of parallelism
But I have a lot of data in variables, and I don't need that part of the program at all
If I use Perl threads, it copies all variables every time a new thread is created In my case, it's painful
If there is no copy, what should I use to create a new thread? Or are there some better thread implementations that don't copy everything?
Solution
Is it as easy as syntax to thread instead of all the fat? Use the amazing forks module! It uses fork and IPC to implement thread interface, which makes it easy to share data between sub processes
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码