C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Forced stopping of RAII compliant execution threads. POSIX threads.

From: Yuri Petrenko <petrenkoyura1981_at_[hidden]>
Date: Sat, 15 Jul 2023 16:27:04 +0300
It's great that Linux already has something to rely on, but there is a
subtle difference. In the case you mentioned, as far as I understand,
pthread_cancel will ask the thread to cancel, and this will be possible
only when we reach the Cancelation point, this mechanism is much better
than a stop token, but very similar to it. In case of RAII thread we can
interrupt the execution thread immediately without waiting for Cancelation
point or token check, except for a few intervals like prologue and
epilogue, destructor (destructors need to be discussed in detail), etc.,
where special handling is needed.
In case of pthread there are points at which we cancel the thread, in case
of RAII thread there are certain intervals at which we can/can't destroy
it. The gist of this idea is that if the thread corresponds to RAII as a
whole, it is not necessary to wait for Cancellation point. In general, I
would really like to use the handler mechanism you mentioned. I'll be sure
to add the relevant part to the discussion, thank you.

Received on 2023-07-15 13:27:17