Blocking task queue without specialized code #2040
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When discussing #1837, @mhammond asked me a great question: should blocking task queues be UniFFI's responsibility? This is my attempt to see what would happen if we decided it wasn't.
The code here implements more-or-less the same feature as #1837, but without changing any UniFFI code. Instead it leverages async callback methods to implement it.
Benefit of this approach:
futures.executor.ThreadPoolExecutor
. With this approach, they can use whatever technology they want.Downsides of this approach:
'static
and cannot use references from their local scope. This makes the code somewhat awkward. Here's similar code in the other PR, note that it could stay basically the same even it used&self
or any other reference.So, should we try to implement #1837 or not? My feeling is that it's not clear, so for
0.27
maybe we should just merge this one and let that one hang out for a while.