future Questions

2

Solved

Given this code val f1: Future[Int] = Future { 5 } //Future.failed(new Exception("sorry")) val f2: Future[Int] = Future { 6 } val result : Future[Int] = f1.fallbackTo { println("Fall back to tha...
Languishment asked 20/9, 2014 at 8:43

1

I am attempting to make a future that continuously finds new work to do and then maintains a set of futures for those work items. I would like to make sure neither my main future that finds work to...
Ransom asked 18/10, 2019 at 18:14

5

Solved

I might have the wrong idea of Isolate and Future. Please help me to clear it up. Here is my understanding of both subjects. Isolate: Isolates run code in its own event loop, and each event may ru...
Jonahjonas asked 25/9, 2018 at 12:57

2

Solved

I am used to Scala's Future type where you wrap whatever object you're returning in Future[..] to designate it as such. My Rust function hello returns Query and I don't seem able to pass that resul...
Acme asked 31/8, 2021 at 18:28

10

Solved

The concurrent.futures.Executor.map takes a variable number of iterables from which the function given is called. How should I call it if I have a generator that produces tuples that are normally u...
Paisano asked 22/7, 2011 at 3:4

6

Solved

I'm trying to build my first mobile application with flutter and firebase. When I try to display and store a photo I have the following issue : error: The argument type 'Future' can't be assign...
Hylton asked 16/4, 2018 at 9:34

6

Solved

is it possible to create your own futures in Dart to return from your methods, or must you always return a built in future return from one of the dart async libraries methods? I want to define a f...
Gemma asked 24/8, 2013 at 22:17

3

Solved

Future.apply starts an asynchronous computation whereas Future.successful creates an already completed Future with the specified result. Now is Future(None) (Future.apply(None)) less efficient tha...
Doris asked 30/1, 2014 at 20:18

1

Signaling between threads can be achieved with std::promise/std::future or with good old condition variables. Can someone provide examples/use case where one would be a better choice over the other...
Quasijudicial asked 20/10, 2017 at 18:42

5

Solved

I have a Try that throws Exception. I want that Try to become a Future so I will be able to recoverWith. How can I convert the Try into a Future without handling any exceptions in the Try (just in ...
Garrard asked 19/9, 2016 at 20:53

8

Solved

I am using a plugin for flutter called search_widget. The data parameter of this widget takes a list. But as I use sqlite for fetching data, I have it in Future<List> form. Is there any way I...
Lavalley asked 26/12, 2019 at 13:18

2

I have a problem with C++ 11 future/promise. The following code works fine: string s = "not written"; void write(promise<void>&& writePromise) { cout << "\nwrit...
Strop asked 6/7, 2020 at 19:21

2

How do you memoize your futures? I am using a FutureBuilder that gets items data by some params. I found here a suggestion to use AsyncMemoizer, however it looks like it's missing from the dart:a...
Eslinger asked 18/4, 2020 at 22:16

5

Say I have the following code: def func(a,b): return (func2(a),func3(3)) def paralel_func(alist,blist) with ThreadPoolExecutor(max_workers=None) as executor: executor.map(func,alist,blist) H...
Omdurman asked 6/4, 2018 at 9:59

4

The following way of iterating a list of future always wait for the first job to be done: for (Future<MyFutureResult> future : list) { List<MyFutureResult> result = future.get(); } Is...
Saltatorial asked 22/10, 2019 at 18:56

5

Solved

Background: I have a function: def doWork(symbol: String): Future[Unit] which initiates some side-effects to fetch data and store it, and completes a Future when its done. However, the back-end...
Peggypegma asked 23/11, 2014 at 2:50

1

Having this simple code: import asyncio async def main(): f = asyncio.Future() await f asyncio.run(main()) A coroutine(here main) can await on Future object. It's basically blocked until f eit...
Avery asked 24/7, 2022 at 6:25

2

Solved

The tokio tutorial for select! states: The thing to note is that, to .await a reference, the value being referenced must be pinned or implement Unpin. Indeed, the following code fails to compile:...
Missie asked 30/7, 2022 at 11:29

8

Solved

Java 8 introduces CompletableFuture, a new implementation of Future that is composable (includes a bunch of thenXxx methods). I'd like to use this exclusively, but many of the libraries I want to u...
Tanked asked 25/4, 2014 at 19:38

4

I want to do something after a lot of future functions are done, but I do not know how to write the code in dart? the code is like this: for (var d in data) { d.loadData().then() } // when all loa...
Sitwell asked 11/2, 2017 at 12:54

5

Solved

In my flutter app, I have a future that handles http requests and returns the decoded data. But I want to be able to send an error if the status code != 200 that can be gotten with the .catchError(...
Stanfield asked 1/2, 2019 at 7:19

1

Solved

What I wanted to achieve, was to retrieve a document from firestore, and provide it down the widget tree, and be able to make changes on the data of the document itself. show something like "...

2

Solved

Since Python 3.5, the keywords await and async are introduced to the language. Now, I'm more of a Python 2.7 person and I have been avoiding Python 3 for quite some time so asyncio is pretty new to...
Pavilion asked 26/11, 2017 at 5:31

3

Solved

I have some troubles in understanding how future builder works in flutter. I want to pass a list of String from my future call and I want to display them in a SingleChildScrollView. The problem is ...
Magnify asked 22/2, 2022 at 8:40

6

The service I'm working on uses a Future to run multiple tasks in parallel; each task can take up to a minute to complete. However, it seems the external lib is buggy, since in some occasions (2% o...
Alkalosis asked 12/3, 2022 at 16:43

© 2022 - 2024 — McMap. All rights reserved.