[cppmyth] Cleanup code for thread safety