bug-18935: Fix platform dependent threading issue leading to segfaults on reloads