gitmodimo opened a new pull request, #47129: URL: https://github.com/apache/arrow/pull/47129
### Rationale for this change Throttle is accessed twice - once in Acquire and again using future. As a result current_value_ may not be increased due to throttle being applied and shorty after the returned future may become finished. That leads to issue described in #47124 https://github.com/apache/arrow/blob/c8fe26898ce49c58514f511be58afddce176826b/cpp/src/arrow/dataset/dataset_writer.cc#L682-L684 ### What changes are included in this PR? Change throttle API to return optional (akin to [ThrottledAsyncTaskScheduler ::Throttle](https://github.com/gitmodimo/arrow/blob/3ebe7ee1828793d0a619bcd773eb4d990ccb6b3c/cpp/src/arrow/util/async_util.h#L243)) and prevent race. ### Are these changes tested? Yes ### Are there any user-facing changes? No -- 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. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org