LIHPC-Computational-Geometry / coupe

the concurrent partitioner
https://LIHPC-Computational-Geometry.github.io/coupe/
Apache License 2.0
12 stars 3 forks source link

arcswap: lock vertex *before* gain calculations (and other things) #278

Closed hhirtz closed 1 year ago

hhirtz commented 1 year ago

Otherwise there can be concurrent moves on neighbors V and U when:

  1. Thread A computes the gain of V
  2. Thread B computes the gain of U
  3. Thread A locks V
  4. Thread A checks for locks on neighbors of V -> there are none because B didn't lock U yet
  5. Thread A moves V and releases the lock
  6. Thread B locks U
  7. Thread B checks for locks on neighbors of U -> there are none because A released the lock
  8. Thread B moves U