parallel
parallel copied to clipboard
Is possible to share data from main process to workers?
I would like to know is it possible to create, lets say an array, on the main process and then read this inside workers without copying the entire array inside worker. Also i would like to know if it possible from workers to write on shared variables on the main process
No and no. They're separate processes. They don't have any kind of shared memory.
You can of course put the data into a database or something.
Not by using variables, but you can post messages.
Yeah... to accessing that array you would have to implement a mechanism for the child to ask the parent for a value and the parent to correctly respond to the request using the channel send/receive methods... https://amphp.org/parallel/processes
My amphp IPC library might help vere: https://github.com/danog/ipc
I believe this question has been answered, so I'm closing it. Please open a new issue if you have any further questions. 👍