help: segmentation fault in threads program that use binmode

help: segmentation fault in threads program that use binmode

am 15.06.2011 01:38:46 von anders lee

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-------------



-- =

使用 Opera 革命性的电å=
­é‚®ä»¶å®¢æˆ·ç¨‹åº : http://www=
..opera.com/mail/

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

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

am 16.06.2011 19:00:02 von Shlomi Fish

Hi anders,

On Wed, 15 Jun 2011 07:38:46 +0800
"anders lee" 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:

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@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/