future Questions

1

Solved

I'm using Tokio 1.1 to do async things. I have an async main with #[tokio::main] so I'm already operating with a runtime. main invokes a non-async method where I'd like to be await on a future (spe...
Badinage asked 3/2, 2021 at 20:37

3

Solved

With regards to the paper which describes removing the void specializations for std::future and std::promise P0241R0. This may be a stupid question but the proposed solution is to remove the void s...
Massage asked 19/5, 2017 at 22:22

3

Solved

How would you wait for future response for a specific amount of time? Say, we make a http post request and await for its response before we close the http request, but, we wait for only 3 secs, el...
Pleura asked 5/10, 2018 at 19:25

2

Solved

How we can merge multiple FutureTask so that we can get a callback for all at the same response. We use Future<T> like Future<String> getData(int duration) async { await Future.delayed...
Lowgrade asked 4/7, 2020 at 16:29

9

Solved

What's the difference between Future and Promise? They both act like a placeholder for future results, but where is the main difference?
Extraterrestrial asked 26/1, 2013 at 21:56

2

Solved

I'm trying to achieve this with the new async/await syntax, std::future::Futures and a recent version of Tokio. I'm using Tokio 0.2.0-alpha.4 and Rust 1.39.0-nightly. Different things I've tried i...
Szeged asked 30/9, 2019 at 18:55

1

Solved

In the documentation for the Send trait, there is a nice example of how something like Rc is not Send, since cloning/dropping in two different threads can cause the reference count to get out of sy...
Geology asked 5/2, 2021 at 10:37

2

I'm using google test and am trying to mock a method that returns a future. What I'm doing is creating some future object in a test case, then I do "when(mock.Call()).thenReturn(myFutureObject...
Pillbox asked 30/1, 2021 at 17:32

4

In C++ you can start a thread with a deferred or asynchronous launch policy. Is there a way to replicate this functionality in Java? auto T1 = std::async(std::launch::deferred, doSomething()); auto...
Sporting asked 26/1, 2021 at 20:52

1

Solved

I want to await an async function inside a closure used in an iterator. The function requiring the closure is called inside a struct implementation. I can't figure out how to do this. This code sim...
Brahmi asked 24/1, 2021 at 14:14

1

Solved

I want to be able to pass an mutable reference to function, but catch unwinds that may come from that function. The purpose is for use in writing some test wrappers (setup, teardown), not general e...
Coincident asked 17/1, 2021 at 15:45

2

I want to call async function in Future::poll(), but the poll() is not async function, so I have to poll the async fn, but got error: error[E0599]: no method named `poll` found for opaque typ...
Cooncan asked 11/1, 2021 at 7:44

2

Solved

Is it possible (logical?) to convert a result containing a future into a future that resolves to a result? The following function is a bit broken, but hopefully makes what I am trying to achieve mo...
Archiepiscopal asked 17/12, 2020 at 14:2

2

I want to serve multiple connections using warp so that I can redirect every http request to https. Here is what I am up to right now. #[tokio::main] async fn main() { let http_routes = warp::pat...
Quilmes asked 25/4, 2020 at 9:58

1

I want to create a DAG out of tasks in Java, where the tasks may depend upon the output of other tasks. If there is no directed path between two tasks, they may run in parallel. Tasks may be cancel...
Ootid asked 30/11, 2020 at 12:29

1

Solved

I have the following methods: @EnableAsync @Service Class MyService{ private String processRequest() { log.info("Start processing request"); try { Thread.sleep(5000); } catch (Inte...
Excogitate asked 6/11, 2020 at 17:17

2

Solved

I am trying to navigate inside a streambuilder but I have this error:"setState() or markNeedsBuild() called during build.". If I call navigate inside an onpressed button it works but not by just us...

3

Solved

I have a future which wraps a TCP stream in a Framed using the LinesCodec. When I try to wrap this in a test, I get the future blocking around 20% of the time, but because I have nothing listenin...
Uprising asked 19/9, 2018 at 9:3

2

Solved

I'm working on an app that captures and processes an image. A simplified version of the code is: build() { return FloatingActionButton( onPressed: processImage, child: Icon( Icons.camera_alt, ...
Epergne asked 25/10, 2020 at 3:17

3

Solved

I'm working on a Flutter app which fetches the user's current location, but while the location is being fetched, it shows this ugly red error screen (which disappears once the location is fetched)....
Daughterinlaw asked 22/10, 2019 at 11:57

1

Solved

I have the following method: Future<List<Job>> getUserJobs() async { Query query = _firebaseDatabase .reference() .child("jobs") .child(_firebaseAuth.currentUser.uid) .or...

1

Solved

Given a collection of Futures, say a Vec<impl Future<..>>, how can I block and run all of the Futures concurrently until the first Future is ready? The closest feature I can find is the...
Binetta asked 3/9, 2020 at 2:25

3

Solved

I've given concurrent.futures.ThreadPoolExecutor a bunch of tasks, and I want to wait until they're all completed before proceeding with the flow. How can I do that, without having to save all the ...
Peyton asked 15/1, 2014 at 16:40

3

Solved

I ran in to a strange issue with Vert.x futures the other day that doesn't break the code but bothers me still. Future without parameter results in the following warning: Future is a raw type. ...
Cancroid asked 4/1, 2017 at 15:7

3

Solved

I am converting code from python2 to python3 for newstyle classes using future. My project is in Django 1.11 I have a class in forms.py as: class Address: ...rest of code... class AddressForm(A...
Jasik asked 29/8, 2018 at 13:33

© 2022 - 2024 — McMap. All rights reserved.