I was reading this: http://en.wikipedia.org/wiki/Thread_safety
Is the following function thread-safe?
void foo(int y){
int * x = new int[50];
/*...
new and delete may or may not be thread safe. They probably are, but that is implementation-dependent. See: C++ new operator thread safety in linux and gcc 4
To be thread safe, a function must either use stack variables or synchronize its access to other resources with other threads. As long as separate calls to new allocate different space on the heap when called from different threads, you should be fine.