A token is always valid unless: 1) Memory allocation failed during construction 2) It was moved via the move constructor (Note: assignment does a swap, leaving both potentially valid) 3) The associated queue was destroyed Note that if valid() returns true, that only indicates that the token is valid for use with a specific queue, but not which one; that's up to the user to track.
| 704 | // that the token is valid for use with a specific queue, |
| 705 | // but not which one; that's up to the user to track. |
| 706 | inline bool valid() const { return producer != nullptr; } |
| 707 | |
| 708 | ~ProducerToken() |
| 709 | { |