If you post a code snippet without appropriate tags one more time, you will get a temporary ban on the forum.

No, a and b don't have to be thread safe.