help: segmentation fault in threads program that use binmode

when i use binmode in threaded program, i got a segmentation fault;

i comment the binmode line, the program works well


use threads;
use threads::shared;

use utf8;
binmode(STDOUT, ':encoding(utf8)';

-------thread create and join-------------



-- =

ä=BD=BF=E7=94=A8 Opera =E9=9D=A9=E5=91=BD=E6=80=A7=E7=9A=84=E7=94=B5=E5=
=AD=90=E9=82=AEä=BB=B6=E5=AE=A2=E6=88=B7=E7=A8=8B=E5=BA=8F : http://www=
..opera.com/mail/

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
anders lee [ Mi, 15 Juni 2011 01:38 ] [ ID #2061093 ]

Re: help: segmentation fault in threads program that use binmode

Hi anders,

On Wed, 15 Jun 2011 07:38:46 +0800
"anders lee" <jianghumanbu [at] gmail.com> wrote:

>
> when i use binmode in threaded program, i got a segmentation fault;
>
> i comment the binmode line, the program works well
>
>
> use threads;
> use threads::shared;
>
> use utf8;
> binmode(STDOUT, ':encoding(utf8)';
>

Well, it's not a good idea to use threads in Perl:

<perlbot> rindolf: Before you start implementing code using Perl's
threads, please remember that Perl's threads are not like other
threads. Please see http://perldoc.perl.org/perlthrtut.html to learn
more; specifically the "What kind of threads are perl threads?"
section. Also see: http://www.perlmonks.org/index.pl?node_id=288022

Please consider using forking or an asynchronous I/O framework
for Perl such as POE, IO::Async or Reflex, instead.

Regards,

Shlomi Fish

--

------------------------------------------------------------ ---------
Shlomi Fish http://www.shlomifish.org/

Chuck Norris can make the statement "This statement is false" a true
one.

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Do, 16 Juni 2011 19:00 ] [ ID #2061231 ]
Perl » gmane.comp.lang.perl.beginners » help: segmentation fault in threads program that use binmode

Vorheriges Thema: Hash or array & retrieving hash value
Nächstes Thema: perl alias