tfeda opened a new issue, #388:
URL: https://github.com/apache/arrow-ballista/issues/388
**Is your feature request related to a problem or challenge? Please describe
what you are trying to do.**
@Dandandan, I think we could improve on #378 by using
`tokio::sync::Semaphore` to wait for task slots to open up, rather than sleep
spinning. It could look something like this:
```
let available_task_slots = Arc::new(Semaphore::new(num_task_slots))
loop {
// thread sleeps until permits are dropped
let task_permit = available_task_slots.acquire_owned().await
// poll scheduler for work
if work_is_available {
tokio::spawn(async move {
// task work
// move permit into task scope
drop(task_permit)
})
}
// If no work is available, task_permit gets dropped here
}
```
Looking at the current implementation, its pretty much the same thing as
what a tokio semaphore does, except with the sleeping spin loop.
**Describe alternatives you've considered**
Just a thought, implementing this isn't a deal breaker
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]