Ah so, Well lets just put down everything.
[root@perlbox sandbox]# ls
file1.pl file2.pl memory
[root@perlbox sandbox]# cat memory
XXXXXXXXXXXXXxxxxXxXXXXXXX
[root@perlbox sandbox]# cat file1.pl
use File::Map qw/:map lock_map sync/;
use warnings;
use strict;
my $mmap = undef;
my $file = "memory";
map_file $mmap, $file, '+<';
if (!defined($mmap)) { print "ERROR!!\n"; }
for(my $i=0;$i<10000;++$i) { $mmap = $i; sync($mmap,1); }
unmap ($mmap);
[root@perlbox sandbox]# perl file1.pl
[root@perlbox sandbox]# cat memory
XXXXXXXXXXXXXxxxxXxXXXXXXX
[root@perlbox sandbox]#
So as you see it doesn't write to the memory file, while I would have guessed it would have write down some numbers, Since of..
use File::Map qw/:map lock_map sync/;
use warnings;
use strict;
my $mmap = undef;
my $file = "memory";
map_file $mmap, $file, '+<';
if (!defined($mmap)) { print "ERROR!!\n"; }
for(my $i=0;$i<10000;++$i) { <b>$mmap = $i;</b> sync($mmap,1);
+ }
unmap ($mmap);
the Bold code.
Already thanks a lot. Is this the information required?
|