Self-test questions
For multiple choice questions, choose all options that apply:
- What happens if you do not call
join
ordetach
on aboost::thread
object and astd::thread
object?a.
join
is called on underlying thread ofboost::thread
.b.
std::terminate
is called forstd::thread
, terminating the program.c.
detach
is called on underlying thread ofboost::thread
.d.
detach
is called on underlying thread ofstd::thread
. - What happens if an exception is allowed to propagate past the initial function with which a
boost::thread
object is created?a. The program is terminated via
std::terminate
.b. It is undefined behavior.
c. The call to
get
on thefuture
object throws an exception in the calling thread.d. The thread is terminated but the exception is not propagated.
- Should you call
notify_one
ornotify_all
on acondition_variable
object without holding the associated mutex?a. No, the call will block.
b. Yes, but it may result in priority inversion in some cases.
c. No, some waiting threads may miss the...