I think because spawn is non-blocking the if statement is evaluated before test is ever run, leaving success in its default state, which happens to be false.
You could test this by changing success into an int and setting any number other than 0 instead of true in test. What should also work is taking the if statement out of the parallel block, as i assume all operations within the parallel block need to be finished before continuing.