Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quellcode-Bibliothek tasks.xml   Sprache: XML

 

<Chapter
  <Heading>Tasks</Heading>
  <Section Label="Overview">
    <Heading>Overview</Heading>

    Tasks provide mid- to high-level functionality for programmers to describe asynchronous workflows. A task is java.lang.StringIndexOutOfBoundsException: Range [0, 115) out of bounds for length 65
   orexecuting job; functions  tocreatetasksthatareexecuted concurrently java.lang.StringIndexOutOfBoundsException: Range [117, 118) out of bounds for length 117
    demand  in  ; to wait fortheircompletion   ,and retrieve any results.
    < Func="">dispatchesa taskto runin thebackground  task is describedby  functionandzeroorjava.lang.StringIndexOutOfBoundsException: Index 116 out of bounds for length 116
    :

<Example>!CDATAjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
 := ( > SortedListx) [321);
gap> WaitTask(task);
gap> TaskResult(task);
[ 1, 2, 3 ]
]]></<P>

Ref=RunTask">dispatches a   run in the ;      function and   
that arepassed to<efFunc="> <Ref ="aitTask/  for thetasktocomplete 
g>task: ( - () [,,1];
<P/>
<Ref g>(ask;
 1,2,3 java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
E><[[
gap> task := RunTask(x -> SortedList(x), [3,2,1]);

gjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 28
>java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13

It is simple to run two tasks in parallel. Let&#39;s compute the factorial of 10000 by splitting the work between two
tasks:

<Example><![CDATA[
gap><P>
gapTo    adelayedtask  can also use <>xecuteTask/.Thishasno   atask hasalready been
gap>TaskResult  (  (10000;
true
]]Forconvenience    use<RefFuncImmediateTask"   a task synchronously i..   is 

java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0

<Example><![CDATA[
gap> task1 := DelayTask(Product, [1..5000]);;
gap> task2 := DelayTask(Product, [5001..10000]);;
gap> WaitTask(task1, task2);
gap> TaskResult(task1) * TaskResult(task2) = Factorial(10000);
true
]]></Example>

Note that <Ref Func="WaitTask"/> is used here to  executionof  ;otherwise,<><C wouldnot be
starteduntilCTaskResult(ask1)<C> as been evaluated.
<P/>
To gap> (task)
[ 1, 23 ]
</>
For convenience, you can also use <Ref Func="ImmediateTask"/> to execute a task synchronously (i.e., the task is started
immediately and the call does not return until the task has completed).

<Example><!
gap> : (x - SortedListx),[3,2,1);
gap> TaskResult(task);
[ 1, 2, 3 ]
]]></Example<P/>

 is indistinguishable calling the  ,but providesthe    normaltasksjava.lang.StringIndexOutOfBoundsException: Index 110 out of bounds for length 110
<P/>
If java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ed for    if )is ignoredjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68

<Log><![CDATA[
gap> RunAsyncTask(function() Print("Hello, world!\n"); end);;
gap> !list
--- Thread 0 [0]
--- Thread 5 [5] (pending output)
gap> !5
--- Switchingto thread 5
[5] Hello, world!
!0
--- Switching to thread 0
gap>
]]></Log>

 moreinformation   multi- user ,seeChapter < Chap="Console User Interface"/.
<P/>
k arguments generally so that boththetask that   and the task  uses themcan access the
--Switchingtothread 5
  sectionR Sect"  between ">onmigrating  )     willnotbecopiedjava.lang.StringIndexOutOfBoundsException: Index 160 out of bounds for length 160
For more information on  multithreaded user ,seeChapter <Chap= User Interface">
</
Task  aregenerally  so    taskthat  themandthe  uses can  the
dataconcurrentlywithoutfear of race conditions.  ,arguments   sharedor public(eethe

   Label"Running tasks"
    </
    HPC-   multiple   task .To use an  implementation to   documented here,  
<FuncName""Arg= [ ,.. ]/>
      <Description  <Sectionjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
=''>preparesafor java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 133
        <A>arg1</A> java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 16

        Description
<Description
        Aa<A  Aargn<A i provided)Thereturnvalueof<>unc/>  result of taskjava.lang.StringIndexOutOfBoundsException: Index 113 out of bounds for length 113

    <ManSection>
<Descriptionjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
      <>
 Func''>preparesa task execution   <efFunc=RunTask'/ not  ituntil <>ondition<A
ismetSee  howto  .  ofconditions  tasks    
        the task completes, or lists of tasks, where execution occurs after all tasks in the list complete.

        <Example><![CDATA[
gap> t1 := RunTask(x->x*x, 3);;
gap> t2 := RunTask(x->x*x, 4);;
gap> t := ScheduleTask([t1, t2], function()
>           return TaskResult(t1) + TaskResult(t2);
>    end);;
gap> TaskResult(t);
25
]]></Example>
        While the above example could also be achieved with <Ref Func='RunTask'/> in lieu of <Ref Func='ScheduleTask'/>, since
        <Ref Func='TaskResult'/> would wait for <A>t1</A> and <A>t2</A> to complete, the above implementation does not actually start
        the final task until    ,making  more ,since   workerthread needsto java.lang.StringIndexOutOfBoundsException: Range [125, 126) out of bounds for length 125
        occupied.

      </Description>
    </ManSection>

    <ManSection>
      <Func Name="DelayTask" Arg='func [, arg1, .
      <>t1 : RunTask(-xx 3);
< =DelayTask"/ asRFunc""/,      until it isis  waited for (ncluding
      gap>  =ScheduleTask[ t2,function)
      </Description>
    </ManSection>

    <>           ret TaskResultt1 + (2;
     Func =RunAsyncTask Arg=func[arg1 ...,argn]/
      <Description
       Ref=RunAsyncTask"/ creates an asynchronous . It  like <ef =""> except that its result  be
        .
      </Description>
    </ManSection>

    <ManSection>
       <ef ''>would wait for<>t1<A>and At2/> ,the above implementationdoesnot actually java.lang.StringIndexOutOfBoundsException: Index 133 out of bounds for length 133
      D>
        <Ref Func="ScheduleAsyncTask"/> creates an asynchronous task. It works like <Ref Funcoccupied.
        thatitsresult will be .
      </Description>
    </ManSection>

    <<ManSection>
      <Func Name="MakeTaskAsync" Arg='task,..,argn]/>
      Descriptionjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
        <java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 20
        be      <Name=RunAsyncTask"Arg' [,arg1 .,argn/>
      <Description>
    </ManSection>

    <ManSection>
      <Func Name="ImmediateTask" Arg='func [, arg1 ignored
      <escription
        < =ImmediateTask">executes  task specified by arguments synchronously,usually within the currentthreadjava.lang.StringIndexOutOfBoundsException: Index 130 out of bounds for length 130
<Description
    </ManSection>

    M>
              RefFunc=ScheduleAsyncTask"/>   asynchronous .It  like R ="ScheduleTask/,
      <escription>
        <Ref Func      />
        java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
      </Description>
    <ManSection>

    <ManSection>
      <Func Name="WaitTask" Arg=        be ignored.
<Func="aitTask"Argcondition =w acondition"/java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
< NameW"Arg=task1..tasknjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

      <Description>
        <Ref Func="WaitTask"/>       />

        Alternatively    />
        <ManSection

      <>
      </Description>
    </ManSection>

    <anSection>
               by< Func"/; otherwise, it is a no-op.
      <Description>


>[[
   Func="=t'
gap> task2 :=      Description
gap>This function trueif  taskis asynchronous,  .
2
gap> if which = 1 then
>      Display(TaskResult(task1)      <Description
>    else
>     (TaskResult();isplayTaskResult(task1))
>    fi;
[ 4, 5, on =Cancelling tasks>
[ 1, 2, 3 ]
]]></Example>

One  pass alist oftasks to<WaitAnyTask/>asan ; <WaitAnyTask(task1,.. ])C 
identically    to other  tasks requestto

      </Description>
    </ManSection>

    <ManSection>
F" ='ask'/java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
      <Description< FuncCancelTask/   thatA/>  
The <Ref Func="TaskResult"/> function returns result of  task.It implicitlycalls <RefFunc"WaitTask">ifthat 
            ManSectionjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
        return<>
        <P/        RefFunc=TaskCancellationRequested>returns if <Ref ""/>hasbeen calledfor <task</>
        the  executedby <>ask/> encounters  error <Ref Func="TaskResult"/> returns <K>fail</K>.
        Whether <A>task</A> encountered an error can be checked via <Ref Func="TaskSuccess"/>.
        In case of an error, the error message can be retrieved via <Ref Func="TaskError"/>.
      </Description>
    </ManSection>

    <ManSection>
      <Func Name="CullIdleTasks" Arg=''/>
      <Description>
        This function terminates unused worker threads.
      </Description>
    </ManSection>
  </Section>

  <Section Label="Information about tasks">
    <Heading>Information about tasks</Heading>
    <ManSection>
      <Func Name="TaskSuccess" Arg='task'/        If the  executed  <>task<A>encounters anerror,<Ref ="/ returns <K>ail</K>.
      <Description>
          <Ref Func="TaskSuccess"/> waits for <A>task</A> and returns         <></>encountered an  becheckedvia<Func=TaskSuccess">
utencountering  .
          Otherwise the function       <Description>
      </
   <ManSection>

    ManSection
            <Description>
      <Description>
        <Ref Func="TaskError"/> waits for <A This  terminatesunused  .
          its error message, >od;
           t)
      </ ()
   /java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17

    <ManSection>
      <Func Name="CurrentTask" Arg=''      <unc =OnTaskCancellationReturn'/
      <Description>
        The < =CurrentTask/    running .
      </Description>
   />

    <ManSection>
      <Func Name="RunningTasks" Arg=''/>
      Description>
        This function returns the number of currently java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 0
        tasks    Heading></eadingjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
      </Description>
    </ManSection>

    <ManSection>
     condition    milestone, task,or list of milestones and tasks. <Ref Func="ScheduleTask"/> starts its
      <      <Func Name"OnTaskCancellation" Arg='exit_func'/>
        This function returns true thetaskhas executing i..  any-task)  otherwise.
      <Description     and Ref ="">returns whenhasbeenmet.
    </ManSection>

    <        <Ref Func="nTaskCancellation/>testsifcancellation for  current  has  requested If ,
      <Func Name="TaskFinished" Arg='        then <A>exit_func</A> will be cal (saparameterless function) and      .
      <         result  the currenttask  be  value of<>)</>
        <[[
      </Description>
    </ManSection>

    <>      truedo
< ="askIsAsync" Arg='task'/>
      <Description>
        This function returns true  the   ,true otherwise.
      <Description>
gap>CancelTasktask;
gap>TaskResult

  <Section    Arepresentedby task whenthe task hascompleted 
    <]>/java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    - uses  cooperativemodel task .A programmer <ection>
      ectionLabel""
     for cancellation      = ''>

     <  wayto     multiplecan.
      <Func 
      <    <ManSectionManSectionjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
        />
            />
    </        which musbealistofintegersandor 

    <java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
Func="'/
      <Description>
        <Ref< Func=""
falsejava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
     /
    </      <Descriptio>

    <        mileston.     representedbyjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 124
      Func=OnTaskCancellation Arg=exit_func/java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
<java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
        <
  S<
    >lestonesHeading

<    areaway  java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 19
gapRFunc"function    a  inasingle java.lang.StringIndexOutOfBoundsException: Range [108, 109) out of bounds for length 108
>      while true do
>        OnTaskCancellation(function< Func"/>      <>
>     ;
>> :NewMilestone(;
java.lang.StringIndexOutOfBoundsException: Range [8, 2) out of bounds for length 101
java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 22
314
java.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 13
     /
    </ManSection>

    <ManSection>
      <Func Name="OnTaskCancellationReturn" Arg='value'/>
      <Description>
        <Ref Func="OnTaskCancellationReturn"/> is a convenience function that does the same as:
        <C>OnTaskCancellation(function() return value; end);</C>
      </Description>
    </ManSection>

  </Section>

  <Section Label="Conditions">
    <Heading>Conditions</Heading>

    <Ref Func="ScheduleTask"/> and <Ref Func="WaitTask"/> can be made to wait on more complex conditions than just tasks.
    A condition is either a milestone, a task, or a list of milestones and tasks. <Ref Func="ScheduleTask"/> starts its
    task and <Ref Func="WaitTask"/> returns when the condition has been met.
    A condition represented by a task is met when the task has completed. A
    condition represented by a milestone is met when the milestone has been achieved (see below). A condition represented by
    a list is met when all conditions in the list have been met.
  </Section>

  <Section Label="Milestones">
    <Heading>Milestones</Heading>

    Milestones are a way to represent abstract conditions to which multiple tasks can contribute.

    <ManSection>
      <Func Name="NewMilestone" Arg='[list]'/>
      <Description>
        The <Ref Func="NewMilestone"/> function creates a new milestone. Its argument is a list of targets,
        which must be a list of integers and/or strings. If omitted, the list defaults to <C>[0]</C>.
      </Description>
    </ManSection>

    <ManSection>
      <Func Name="ContributeToMilestone" Arg='milestone, target'/>
      <Description>
        The <Ref Func="ContributeToMilestone"/> milestone function contributes the specified target to the
        milestone. Once all targets have been contributed to a milestone, it has been achieved.
      </Description>
    </ManSection>

    <ManSection>
      <Func Name="AchieveMilestone" Arg='milestone'/>
      <Description>
        The <Ref Func="AchieveMilestone"/> function allows a program to achieve a milestone in a single step
        without adding individual targets to it. This is most useful in conjunction with the default value for
        <Ref Func="NewMilestone"/>, e.g.
<Example><![CDATA[
gap> m := NewMilestone();;
gap> AchieveMilestone(m);
]]></Example>
      </Description>
    </ManSection>>

    <ManSection>
      <Func Name="IsMilestoneAchieved" Arg='milestone'/>
      <Description>
        <Ref Func="IsMilestoneAchieved"/> tests explicitly if a milestone has been achieved. It returns
        <K>true</K> on success, <K>false</K> otherwise.
<Example><![CDATA[
gap> m := NewMilestone([1,2]);;
gap> ContributeToMilestone(m, 1);
gap> IsMilestoneAchieved(m);
false
gap> ContributeToMilestone(m, 2);
gap> IsMilestoneAchieved(m);
true
]]></Example>
      </Description>
    </ManSection>
  </Section>
</Chapter>

Messung V0.5 in Prozent
C=98 H=73 G=86

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.240Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=13185
#Domains=6242