Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: Unexpected output from fork (Win32)

by BrowserUk (Patriarch)
on Aug 09, 2004 at 17:51 UTC ( #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:


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?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2023-09-30 10:02 GMT
Find Nodes?
    Voting Booth?

    No recent polls found