in reply to Re^5: fork - child executes code outside of block
in thread fork - child executes code outside of block

No you didn't; execution falls through. You're missing an exit in the parent branch.