canary icon indicating copy to clipboard operation
canary copied to clipboard

improve: fix thread pool shutdown

Open dudantas opened this issue 4 months ago • 1 comments

Description

Fixed an issue where the ThreadPool::shutdown() method would hang indefinitely due to waiting on threads without proper condition signaling.

Depuration with gdb: image

Normal loading: image

Behaviour

Actual

The ThreadPool shutdown process hangs indefinitely with the message "Shutting down thread pool..." without completing.

Expected

The ThreadPool should properly notify threads to complete their tasks and shut down gracefully, avoiding hanging indefinitely.

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested

The fix was tested by reproducing the shutdown scenario where the hanging issue occurred. The shutdown process now correctly notifies threads to complete, and the shutdown process finishes as expected.

  • [x] Tested the shutdown of ThreadPool after an error in loading, confirming no indefinite hang.

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I checked the PR checks reports
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] My changes generate no new warnings

dudantas avatar Oct 21 '24 03:10 dudantas