多執行緒程式實作時要注意的地方

多執行緒程式檢查重點:

  1. Data Race
  2. Race Condition
  3. Deadlock
  4. priority inversion
  5. thread explosion

實作時還要檢查:

  1. 在哪個thread上執行(ex: main thread or background thread)
  2. 存取的變數的記憶體是否會正確被釋放
  3. clean code(ex: 避免巢狀結構)