Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Unexpected output from fork (Win32)

by BrowserUk (Patriarch)
on Aug 09, 2004 at 17:51 UTC ( [id://381312]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Unexpected output from fork (Win32)
in thread Unexpected output from fork (Win32)

A couple of things.

First, as Win32 pseudo-forks are threads, you can (apparently) use threads::shared to share an array (or other data) between them:

From threads::shared POD:

DESCRIPTION

By default, variables are private to each thread, and each newly created thread gets a private copy of each existing variable. This module allows you to share variables across different threads (and pseudoforks on Win32). It is used together with the threads module.

Though I admit I've never actually tried this.

Second. Doing the equivalent of your OP code using threads is much simpler.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
  • Comment on Re^3: Unexpected output from fork (Win32)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://381312]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found