add two code about thread safe.