Thanks for the suggestion
BrowserUk, I have reviewed the module code for Win32::MMF::Shareable, and after extensive debugging, I (think that I) have discoverred that the module might not be thread safe. I am doing some experiments at the moment to see if I could have independend sets of data both child and parents so they don't interfere with each other, as currently the child and parent share the same set of global data.
I tried your suggestion: I removed the
use Win32::MMF::Shareable line at the start, which gets loaded at compile time, and then added
require in each parent and child processes after the
fork. The problem some how has gone away. The following is the test code I used:
#!C:/Perl/bin/perl -w
use strict;
use Data::Dumper;
if( fork )
{
require Win32::MMF::Shareable;
my $ns = tie( my %share, 'Win32::MMF::Shareable', 'share' ) || die;
sleep(1);
$share{parent} = 1;
print Dumper(\%share);
}
else
{
require Win32::MMF::Shareable;
my $ns = tie( my %share, 'Win32::MMF::Shareable', 'share' ) || die;
$share{child} = 1;
}
Is this because the
require is executed at run-time, which causes two different copy of
Storable to be loaded at run-time, which in turn gets freed properly in their own instances?
And thanks again!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.