79171629

Date: 2024-11-08 21:34:18
Score: 1.5
Natty:
Report link

A comment by IanAbbott led me to the bug. The issue is the comparison I was doing to decide whether or not the queue needed to be realloc'ed. I was comparing against pool->waiting_in_queue, which is incorrect since this is the number of unstarted jobs. What I needed to do was this:

  while (pool->queue_length >= (pool->queue_capacity - 1)) {

That is, comparing the length of the queue itself, and not the number of unstarted jobs.

Thanks for all the helpful comments and advice :)

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (0.5): I need
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: smolloy