Livelock
The following code shows a race condition and a livelock:
- if res is never smaller than TOL, the program spins endlessly in Livelock
- the race may be fixed with a barrier before the single, such that the match function will work better
- also, decide on the maximum number of iterations, rather than an infinite loop
C$omp parallel private(id)
id = omp_get_thread_num()
n = omp_get_num_threads()
phases(id) = update(u,id)