$self->{queue}->enqueue('STOP'); # insert a small Wx time delay here, or use a conditional in the join like: do 1 until $self->{worker}->join; #or code to wait for the thread count to change }