RE: iThreads troubles
[email protected] ("Jerry D. Hedden")
| Newsgroups | perl.ithreads |
|---|---|
| Message-ID | <20060419072428.fb30e530d17747c2b054d625b8945d88.707f872e6a.wbe@email.secureserver.net> |
Daniel Rychlik wrote:
> One of issues that I am having is when the thread enters into
> getAvailableResource routine its not seeing that the
> $Resources{'WAN1'}->{INUSE} = 1; has been made unavailable.
The problem is that you are doing 'share()' on %Resources after
populating
it. This causes the data you put into %Resources to be lost. See
http://annocpan.org/~NWCLARK/perl-5.8.7/ext/threads/shared/shared.pm#note_395
for details.
As such, you should change your code from:
# Runtime Resource handling
our %Resources;
# WAN Resources
$Resources{'WAN1'} = {'DRIVE' => 'O:', 'INUSE' => 0};
...
share(%Resources);
to:
# Runtime Resource handling
our %Resources :shared;
# WAN Resources
$Resources{'WAN1'} = {'DRIVE' => 'O:', 'INUSE' => 0};
...