id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
792	Threaded script output is in the wrong order	szabgab		"Running the following simple script in Padre with the outptut set to be the internal window will show the output in the wrong order
{{{
use strict;
use warnings;

#$| = 0;

use Time::HiRes qw(sleep);
use threads;
#use threads::shared;

my $t = threads->create(\&prt, 3);

foreach my $i (0..4) {
	my $r = rand();
	print ""main $$ $i $r\n"";
	sleep $r;
}
print ""joined: "" , $t->join, ""\n"";

sub prt {
	print ""prt  $$ started\n"";
	foreach my $i (0..$_[0]) {
		my $r = rand();
		print ""prt  $$ $i $r\n"";
		sleep $r;
	}
	return 'z';
}
}}}

Output:
{{{
prt  6861 started
prt  6861 0 0.985413604722456
prt  6861 1 0.58135624751182
prt  6861 2 0.558220611457852
prt  6861 3 0.398723572349759
main 6861 0 0.078701744628237
main 6861 1 0.90126634491341
main 6861 2 0.617402522863028
main 6861 3 0.104640960084858
main 6861 4 0.322318606206938
joined: z
}}}

When using the external output window or when running from the command line I get the expected random order:
{{{
prt  6859 started
main 6859 0 0.355495126060308
prt  6859 0 0.322238944311724
prt  6859 1 0.135644333527551
main 6859 1 0.572476746837737
prt  6859 2 0.78271155435699
main 6859 2 0.230260133083117
main 6859 3 0.606436307166355
prt  6859 3 0.837214991773131
main 6859 4 0.979939686495602
joined: z
}}}
"	defect	new	major		editor	0.95			
