Fix compile errors on threaded Perl.