fixed threading error where a plot command could be given between a line number and a data point

This commit is contained in:
Dima Kogan 2010-06-06 21:38:59 -07:00
parent aed6f30b38
commit 613650c234

View File

@ -190,15 +190,16 @@ if($options{"stream"})
while(<>) while(<>)
{ {
# place every line of input to the queue, so that the plotting thread can process it. chomp;
$dataQueue->enqueue($_);
# if we are using an implicit domain (x = line number), then we send it on the data queue also, # place every line of input to the queue, so that the plotting thread can process it. if we are
# since $. is not meaningful in the plotting thread # using an implicit domain (x = line number), then we send it on the data queue also, since
# $. is not meaningful in the plotting thread
if(!$options{domain}) if(!$options{domain})
{ {
$dataQueue->enqueue($.); $_ .= " $.";
} }
$dataQueue->enqueue($_);
} }
$streamingFinished = 1; $streamingFinished = 1;
@ -347,11 +348,16 @@ sub mainThread {
else else
{ {
# since $. is not meaningful in the plotting thread if we're using the data queue, we pass # since $. is not meaningful in the plotting thread if we're using the data queue, we pass
# $. on the data queue in that case. This construct pulls it from the queue if we're using # $. on the data queue in that case
# it, otherwise it uses $. directly if(defined $dataQueue)
{
# I should be using the // operator, but I'd like to be compatible with perl 5.8 s/ ([\d]+)$//o;
$xlast = defined $dataQueue ? $dataQueue->dequeue() : $.; $xlast = $1;
}
else
{
$xlast = $.;
}
} }
if($options{dataindex}) if($options{dataindex})