# concurrent computation of a function

Suppose I have two functions `f1(x)`

and `f2(x)`

that compute the same entity. Depending on the value of `x`

one may be much faster than the other, or vice versa. It's apriori unknown which of the two functions will be faster for a given `x`

.

So, I'd like like to run the two functions on the given `x`

concurrently in parallel, and as soon as one produces an answer, I'd like to terminate the other function as well and return that answer. Please help me to design such a parallelized function `concurrent_run(f1,f2,x)`

in Sage.