C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Make std::thread not joinable after thread function ends.

From: Smith, Jim <jim.smith_at_[hidden]>
Date: Wed, 21 Jun 2023 19:01:50 +0000
Yes, actually proposing a non-blocking join() that returns true or false because if join() returns false, the thread is not running.

Need a way to say if(thread_is_running) { ... }, and must keep existing logic already in code so future or promise isn't allowed.

The below is closer to what I intended.

>>> If(t.join_will_notblock()) t.join();

Thanks!
James S

------- Original Message -------
On Sunday, June 18th, 2023 at 5:23 PM, Lee Howes via Std-Proposals <std-proposals_at_[hidden]> wrote:

> Are you really asking for a non-blocking join?
>
> If(t.join_will_notblock()) t.join();
>
> That would not be a race because it is a latching property.
>
> Lee

Received on 2023-06-21 19:02:04