Hi all,
I get the message
Bizarre SvTYPE [196] at DirectoryMonitor.pm line 72.
when trying to create a thread:
#in sub DirectoryMonitor::start
$self->{thread} = threads->new(\&monitor, $self);
perl.exe then crashes trying to read memory at 0x00000008.
I have ActivePerl 5.8.0 build 804 on Win2kpro.
Dont really know how to tackle this problem. I just tried a
minimal test case and it worked fine (appended). Im going
to add to it untils something breaks.
Any help appreciated, thanks.
mvh,
#---------------------------------------------------
# Robert Friberg perl,java,xml,uml,sql,delphi,
# Systemutvecklare c/c++,vb,php,linux,apache
# 0733-839080
#
# Ensofus AB linuxservrar,serverhosting,
# www.ensofus.se internetsystem, Milj� Online
#---------------------------------------------------
# The following works fine....
use strict;
use warnings;
use threads;
use threads::shared;
package A;
sub new
{
my %data:shared;
$data{value} = "42";
bless {shared=>\%data}, shift;
}
sub start
{
my $self = shift;
$self->{thread} = threads->new(\&monitor, $self);
}
sub monitor
{
my $self = shift;
for(my $i=0;$i<10; $i++)
{
sleep 1;
print $self->{shared}->{value}++, ": Hi from monitor\n";
}
}
package main;
my $a = new A;
my $thread = $a->start();
$thread->join();