I'm pretty sure you'll have to avoid trying that, because push_back will result in new allocations and such, which are not designed to be thread safe.
If the math you do is complex enough (I suspect not), you can have each thread fill its own vector with the computed values and then append these vectors to build your final vector. The appending operation would be protected by a lock:
Code:
{
tempVec.reserve(N);
for(size_t i = 0; i < N; ++i)
{
tempVec[i] = baxyInt;
}
std::lock_guard<std::mutex> lock(baxyMutex);
xx.insert(xx.cend(), tempVec.cbegin(), tempVec.cend());
}
Something like the above, I haven't checked for errors. But if you really just want to fill a vector with integers, multiple threads might not be the fastest solution.