1. A method comprising: receiving a first code segment, the first code segment having a set of instances of a parallel construct, each of the set of instances of the parallel construct comprised of a task; and translating the first code segment to a second code segment, the second code segment, when being executed to perform operations comprising: allocating a shared value, the shared value to indicate a most current one of the set of instances encountered by one of a team of threads, allocating a private value for each of the team of threads, the private value to indicate one of the set of instances encountered by the private value's corresponding thread of the team of threads, maintaining the shared value with the team of threads, and maintaining the private value of each of the team of threads with the private value's corresponding thread of the team of threads.