---
title: "WaitAsynchronousTask"
language: "en"
type: "Symbol"
summary: "WaitAsynchronousTask is being phased out in favor of TaskWait, which was introduced experimentally in Version 11.2."
canonical_url: "https://reference.wolfram.com/language/ref/WaitAsynchronousTask.html"
source: "Wolfram Language Documentation"
---
# WaitAsynchronousTask

⚠ ``WaitAsynchronousTask`` is being phased out in favor of ``TaskWait``, which was introduced experimentally in Version 11.2.

WaitAsynchronousTask[task] waits for task to complete.

## Details and Options

* ``task`` is an ``AsynchronousTaskObject`` expression.

* ``WaitAsynchronousTask`` waits until ``task`` completes.

* The following option can be given:

"Timeout" 	[`Infinity`](https://reference.wolfram.com/language/ref/Infinity.en.md)	time to wait before returning

---

## Examples (2)

### Basic Examples (1)

Starting an asynchronous task and waiting until it completes is equivalent to running the task synchronously:

```wl
In[1]:=
task = URLFetchAsynchronous["http://exampledata.wolfram.com/5mb.dat", 
	If[#2 === "data", MessageDialog["Download complete."]]&]
WaitAsynchronousTask[task]

Out[1]= AsynchronousTaskObject["http://exampledata.wolfram.com/5mb.dat", 1, 31964330880667280022]
```

### Options (1)

#### "Timeout" (1)

Wait for an asynchronous task to complete and then continue, even if it is not done:

```wl
In[1]:=
done = False;
Print["Starting download at ", DateString[]];
task = URLFetchAsynchronous["http://exampledata.wolfram.com/20mb.dat", 
	If[#2 === "data", done = True;MessageDialog["Download complete."]]&];
WaitAsynchronousTask[task, "Timeout" -> 1.5]
If[!done, Print["Still downloading at ", DateString[]]]

During evaluation of In[1]:= "Starting download at ""Mon 15 Oct 2012 12:32:51"

During evaluation of In[1]:= "Still downloading at ""Mon 15 Oct 2012 12:32:52"
```

## History

* [Introduced in 2012 (9.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn90.en.md)