-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinvalidation.tex
39 lines (31 loc) · 1.55 KB
/
invalidation.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
\abschnitt{invalidation at resumption}\label{invalidation}
The framework must prevent the resumption of an already running or terminated
(computation has finished) fiber.
Resuming an already running fiber will cause overwriting and corrupting the stack
frames (note, the stack is not copyable). Resuming a terminated fiber will
cause undefined behaviour because the stack might already be unwound (objects
allocated on the stack were destroyed or the memory used as stack was already
deallocated).
As a consequence each call of \resume will empty the \fiber instance.
Whether or not a \fiber is empty can be tested with member function \opbool.
To make this more explicit, functions \allresume are rvalue-reference qualified.
%If a fiber calls \cpp{f.resume()} then the fiber is suspended and \cpp{f} is
%invalidated. When the fiber is resumed later, it returns from \cpp{f.resume()}
%and instance \cpp{f} references the calling fiber (the fiber that has resumed
%the current fiber).
The essential points:
\begin{itemize}
\item regardless of the number of \fiber declarations, exactly one \fiber
instance represents each suspended fiber
\item no \fiber instance represents the currently-running fiber
\end{itemize}
Section \nameref{solution_gpub} describes how an instance of\\
\fiber is synthesized from the active fiber that suspends.
\zs{
A fiber API must:
\begin{itemize}
\item prevent accidentally resuming a running fiber
\item prevent accidentally resuming a terminated fiber
\item \allresume are rvalue-reference qualified
\end{itemize}
}