All challenges
Multiple ChoiceBeginner 45s

std::stop_token Cooperative Cancellation

How does a worker check for cooperative cancellation via std::stop_token?
Options
  1. 1It must catch a cancellation exception thrown into the thread at the resume point
  2. 2By polling a global atomic flag that the operating system sets when stop is requested
  3. 3Stop tokens throw std::stop_requested on any access after cancellation has occurred
  4. 4By calling stop_requested() or stop_possible() and/or blocking on the token with a callback

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle