Contenuto principale

getCurrentTask

Get task object from a worker running a task

    Syntax

    Description

    t = getCurrentTask returns the parallel.Task object that the current worker is associated with. Use getCurrentTask to get information from the task during a computation, such as the running duration.

    If getCurrentTask is evaluated on a worker, t is a parallel.Task object. Otherwise, t is an empty double.

    example

    Examples

    collapse all

    Use getCurrentTask and RunningDuration property to find the running duration of the task that a worker is associated with.

    On a worker, use getCurrentTask to get the current task object t from a worker running the task t.

    t = getCurrentTask;

    Then, use the RunningDuration property to get the running duration of the task.

    howLong = t.RunningDuration

    Output Arguments

    collapse all

    Task object, specified as a parallel.Task or empty double. When you use getCurrentTask on a worker, t is the parallel.Task object that the current worker is associated with. When you use getCurrentTask on the client, t is an empty double.

    Data Types: parallel.Task

    Version History

    Introduced before R2006a

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant