If PScan() is called from a cilk_for loop, then using the w array will not be a race. All parallel strands will have their own allocated copy of w. Be sure to free that memory when you're done with it.
However, be aware that calling memory allocation routines like calloc may involve locks which can limit performance. Alternate memory allocators like tbbmalloc can mitigate this.
You can use the Cilkscreen tool to search for races. The Cilk Tools (The Cilkscreen race detector and the Cilkview scalability analyzer) are available for free from http://cilkplus.org/download
- Barry Tannenbaum
Intel Cilk Plus Runtime Development