Asynchronous Tasks

Asynchronous tasks run in the background and evaluate functions asynchronously when there is an event. Asynchronous tasks may run only until some work is completed, or they may be designed to run indefinitely. This tutorial describes how to interact with asynchronous tasks.

AsynchronousTasks[]list running asynchronous tasks
AsynchronousTaskObject["name",id,sessionid]object representing an asynchronous task
StopAsynchronousTask[asyncTask]stop asynchronous evaluations from asyncTask
StartAsynchronousTask[asyncTask]resume asynchronous evaluations from asyncTask
WaitAsynchronousTask[asyncTask]wait for asyncTask to complete
RemoveAsynchronousTask[asyncTask]shut down asyncTask and remove it from the system

Asynchronous task operations.

Normally, there are no asynchronous tasks.
In[1]:=
Click for copyable input
Out[1]=
You can list asynchronous tasks that are running. They will be removed from the list when they complete.
In[2]:=
Click for copyable input
Out[2]=
Out[2]=
Once the dialog telling you the download is complete appears, you can examine the response.
In[3]:=
Click for copyable input
Out[3]//Short=
Out[3]=
Start a download that takes some time to complete.
In[4]:=
Click for copyable input
Out[4]=
Out[4]=
Stop asynchronous evaluations, including progress updates.
In[5]:=
Click for copyable input
Restart the asynchronous evaluations, allowing you to see progress updates and get the response data.
In[6]:=
Click for copyable input
You may want to wait up to a certain amount of time for an asynchronous task to finish.
Start two long downloads.
In[8]:=
Click for copyable input
Out[8]=
Out[8]=
Remove one of the download tasks using its AsynchronousTaskObject expression.
In[9]:=
Click for copyable input
The removed task will no longer be listed.
In[10]:=
Click for copyable input
Out[10]=