Is it a bad idea to write a multi-threaded TCP server daemon in Perl?

Is it a good idea to write multi-threaded programs (in particular, TCP server daemons) in Perl?

+3
source share
7 answers

Perl is a great server language. If you find yourself in any areas where the interpreted code is confusing the application, you can write extension code in C to handle it.

You can also see non-blocking I / O to avoid overhead on threads. IO :: Lambda is a good module for this, simplifying event-based programming to several [anonymous] routines.

+7
source

Perl, , , . . perldoc threads.

+6
+5

Perl, ithreads. , , C, . . perldoc perlthrtut.

+4

, , . , .

, . , , , .

- POE AnyEvent , . , , , . Windows Linux, .

+2

, , , , , .

, , C/++, / . Perl ( , , ), , C/++.

+1

, . , , : Perl ithreads

:

, , perl 5.005, Perl ithreads. ? , , , . , . , , , , . ! :

use threads ();
my $foo;
threads->new( sub {print "thread: coderef = ".\$foo."\n"} )->join;
print "  main: coderef = ".\$foo."\n";

:

thread: coderef = SCALAR(0x1eefb4)
  main: coderef = SCALAR(0x107c90)

, , . , , . , . ? . ( , ), "". , , "" , , . , - ( Thread:: Tie).

+1
source

Source: https://habr.com/ru/post/1719274/


All Articles