Fix multi-thread issue in localmsg API
Merge pull request #659 from PinZhang/pzhang/fix-localmsg-multithread

Fix multithread issue in localmsg API