future Questions

3

Solved

What is the best approach to wrap java 7 futures inside a kotlin suspend function? Is there a way to convert a method returning Java 7 futures into a suspending function? The process is pretty s...
Lundin asked 11/6, 2018 at 8:27

2

Solved

The message below is being printed while setting the result of an asyncio future. Executing <Handle <TaskWakeupMethWrapper object at 0x7fc3435141f8>(<Future finis...ection.py:260>)...
Plexiform asked 24/11, 2017 at 15:37

0

In the description of the std::async it is said that: If the std::future obtained from std::async is not moved from or bound to a reference, the destructor of the std::future will block at the end...
Trichiasis asked 12/8, 2020 at 22:7

3

There are two approaches to submitting and polling task for result FutureTask futureTask = new FutureTask<String>(callable); Use combination of Callable and Future and submit on ExecutorS...
Scribe asked 22/6, 2015 at 9:53

3

I have a list of futures. The problem is that I have a lot of files and I need to make some long operation after every file will be created. That's why I want to make a callback after each "file sa...
Catanddog asked 22/2, 2017 at 14:18

1

Solved

I'm trying to concurrently run a function on each file in a directory. Sadly whenever I use Futures my program doesn't want to terminate (runs forever). I have tried using Await.result() with the s...
Proliferate asked 13/7, 2020 at 21:14

4

Solved

When using an ExecutorService and Future objects (when submitting Runnable tasks), if I specify a timeout value to the future's get function, does the underlying thread get killed when a TimeoutExc...
Town asked 26/4, 2013 at 8:1

1

I have tasks that are executed inside a threadpool that share a reentrant read write lock. these tasks return futures if there execution finishes. The reentrant read write lock will wait on a condi...
Disconnection asked 16/10, 2019 at 9:58

4

Solved

How large is Scala's thread pool for futures? My Scala application makes many millions of future {}s and I wonder if there is anything I can do to optimize them by configuring a thread pool. Than...
Anticathode asked 8/3, 2013 at 1:41

2

Solved

I have a struct Test I want to implement std::future::Future that would poll function: use std::{ future::Future, pin::Pin, task::{Context, Poll}, }; struct Test; impl Test { async fn functio...
Dysgenic asked 18/4, 2020 at 19:38

6

Solved

In Scala there is a Promise class that could be used to complete a Future manually. I am looking for an alternative in C#. I am writing a test and I want it to look it similar to this: // var My...
Asthenosphere asked 17/8, 2016 at 12:24

3

Solved

Working with Futures in Dart, I've come across an interesting issue. import 'dart:async'; class Egg { String style; Egg(this.style); } Future cookEggs(List<Egg> list) => new Future...

6

Solved

I was hoping code like follows would wait for both futures, but it does not. object Fiddle { val f1 = Future { throw new Throwable("baaa") // emulating a future that bumped into an exception }...
Vaporimeter asked 30/3, 2015 at 10:59

2

Solved

My Flutter project has a utility.dart file and a main.dart file. I call the functions in the main.dart file but it has problems. It always showAlert "OK", i think the problem is the the utility cla...
Luminous asked 24/9, 2018 at 10:35

4

Solved

I've read the docs about map and flatMap and I understand that flatMap is used for an operation that accepts a Future parameter and returns another Future. What I don't fully understand is why I wo...
Econometrics asked 26/7, 2015 at 19:42

6

Solved

I'm looking for a way to convert an arbitrary length list of Futures to a Future of List. I'm using Playframework, so ultimately, what I really want is a Future[Result], but to make things simpler,...
Vida asked 1/1, 2014 at 23:1

2

Solved

use futures::{future, Future}; fn test() -> Box<dyn Future<Output = bool>> { Box::new(future::ok::<bool>(true)) } async fn async_fn() -> bool { let result: bool = test()...
Dragone asked 6/3, 2020 at 9:54

3

Solved

I have the following code: #include <iostream> #include <future> #include <chrono> #include <thread> using namespace std; int sleep_10s() { this_thread::sleep_for(chrono...
Cutie asked 23/8, 2012 at 7:20

2

Solved

How can I return Future<void> ? Future<void> deleteAll(List stuff){ stuff.forEach( s => delete(s)); //How do I return Future<void> when loop and all delete Operation are fin...
Scarify asked 31/1, 2020 at 9:20

1

Solved

I'd like to be able to sleep my future for a single "frame" so that other work can happen. Is this a valid implementation of this idea? use std::future::Future; use std::task::{Context, Poll}; use...
Bournemouth asked 29/1, 2020 at 19:16

2

All futures may be successful eventually (and some may fail), but we want the first successful one. And want to represent that result as a future. This future will fail if all the futures in ...
Lobe asked 23/1, 2020 at 20:52

3

Solved

I have a function that generates a futures::Stream based on an argument. I want to call this function multiple times and flatten the streams together. Complicating matters is the fact that I want t...
Newborn asked 11/1, 2020 at 19:14

1

Solved

Rust has async methods that can be tied to Abortable futures. The documentation says that, when aborted: the future will complete immediately without making any further progress. Will the vari...
Adz asked 6/1, 2020 at 14:25

1

Solved

I am trying to connect to a database: extern crate tokio; // 0.2.6, features = ["full"] extern crate tokio_postgres; // 0.5.1 use futures::executor; use tokio_postgres::NoTls; fn main() { let f...
Plovdiv asked 3/1, 2020 at 16:56

3

Solved

I want to make some cleanup (like close db connection) after a Future is complete. Currently I achieve it this way: Future { ... } onComplete { case Success(v) => // ... conn.close() case F...
Alyssaalyssum asked 25/12, 2019 at 9:46

© 2022 - 2024 — McMap. All rights reserved.