
Go backward to Representation
Go up to Threads
Go forward to Basics
Definition
Thread<R>
t
Threadn<R, A_1, ..., A_n>
t
Threadn<R, A_1, ..., A_n>
t(f, a_1, ..., a_n)
R (*f)(A_1, ..., A_n)
A_i a_i
Specification: Defines a thread handle t.
- In the first form, t may be bound to any thread that returns a
result of type R. t is not yet bound to any thread.
- In the second form, t may be bound to any thread that takes n
arguments of types A_i and returns a result of
type R. t is not yet bound to any thread.
- In the third form, t is bound to a new thread that returns
f(a_1, ..., a_n).
Note: A thread handle of type Threadn<R, A_1,
..., A_n> is implicitly converted to a thread handle of type
Thread<R> whenever such a type is
expected. Thus e.g. the following is legal:
Thread<R> s
Threadn<R, A_1, ..., A_n>
t(f, a_1, ..., a_n)
s =
t
Restrictions: The number of arguments n ranges from 0 to an
implementation-dependent constant (currently 4). This range may be extended
by defining the corresponding template class.
Implementation: The third form is more efficient than the otherwise
equivalent form
Threadn<R, A_1, ..., A_n> t
t =
Threadn<R, A_1, ...,
A_n>(f_1, a_1, ..., a_n)
Normally this form is also equivalent to
to
Threadn<R, A_1, ..., A_n>
t
t.create
(f_1, a_1, ...,
a_n)
However, if the preprocessor constant
RT_THREAD_NOTLAZY
is defined before including
the header file rt++.h,
the declaration is equivalent to
Threadn<R, A_1, ..., A_n>
t
t.start
(f_1, a_1, ...,
a_n)
Wolfgang.Schreiner@risc.uni-linz.ac.at
Id: main.tex,v 1.10 1996/04/04 11:45:47 schreine Exp