Merge pull request #5593 from lhchavez/fix-mwindow-thread-unsafety Make the pack and mwindow implementations data-race-free