elaborate on share usage
[msc-thesis1617.git] / arch.lift.tex
1 If the user does not want to know where and when a \gls{mTask} is actually
2 executed and is just interested in the results it can lift the \gls{mTask} to
3 an \gls{iTasks}-\gls{Task}. The function is called with a name, \gls{mTask},
4 device and interval specification and it will return a \gls{Task} that finishes
5 if and only if the \gls{mTask} has returned.
6
7 \begin{lstlisting}[caption={Starting up the devices}]
8 liftmTask :: String (Main (ByteCode () Stmt)) (MTaskDevice, MTaskInterval) -> Task ()
9 liftmTask wta mTask c=:(dev, _)= sendTaskToDevice wta mTask c
10 >>= \t->wait "Waiting for mTask to return" (taskRemoved t) (deviceShare dev)
11 >>| viewInformation "Done!" [] ()
12 where
13 taskRemoved t d = isNothing $ find (\t1->t1.ident==t.ident) d.deviceTasks
14 \end{lstlisting}