Fix compilation on threaded perls