Search notes:

Perl module threads::shared

use warnings;
use strict;

use threads;
use threads::shared;

my $foo = 1;
my $bar = 1;

share($bar);


my $t1 = threads->create(\&thr, 1);
my $t2 = threads->create(\&thr, 2);
my $t3 = threads->create(\&thr, 3);

$t1 -> join();
$t2 -> join();
$t3 -> join();



sub thr { # {{{

    my $init_wait = shift;

    sleep $init_wait;

    $foo ++;
    $bar ++;

    print "foo: $foo, bar: $bar\n";


} # }}}
Github repository PerlModules, path: /threads/shared/script.pl
Perl modules.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759407807, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/threads/shared/index(70): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78