westonpace commented on pull request #9941: URL: https://github.com/apache/arrow/pull/9941#issuecomment-816376215
Ok. I got lost trying to simplify things with an enum and, in the process, found a bug where a really fast consumer could try and restart the queue multiple times. @pitrou @lidavidm So, I have reworked it and I think it is a bit easier to reason with now (a bit). Every background task gets a future that it marks complete when it finishes. The background task cannot be restarted (and the cleanup cannot finish) until that future has been marked complete. There is still a "running" flag so that we know when we add an item to the queue if we have to restart the background task (because it is no longer running and merely cleaning up) or not (because it is still running and will pick it up on the next loop). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org