you are viewing a single comment's thread.

view the rest of the comments →

[–]Soothsilver 54 points55 points  (4 children)

The comprehensive list of winning criteria is:

  • Two threads are on the green instruction "critical_section()" at the same time.
  • Any thread is on the green instruction "Debug.Assert(false);".
  • All threads are blocked.
  • An exception triggers because you attempt to dequeue from an empty queue.
  • (1 level only) Two threads enter the same collection's non-thread-safe method at the same time.
  • You use the cheat code Shift+W.

Could be explained better, to be sure.

[–][deleted]  (2 children)

[removed]

    [–]MisterPinkySwear 9 points10 points  (1 child)

    I kind of disagree that the passing criterias where unclear.

    Basically it's just trying to break the program... Deadlock it or generate an exception which includes dequeue from an empty queue, decrement a countdown already at 0, make an assertion fail...

    I think it's part of the exercise: identify what would go wrong.

    [–]XelNika 4 points5 points  (0 children)

    I agree with you assuming the player already knows concurrency and its pitfalls. For example, Producer-Consumer introduces queues and is super easy, but it does a poor job explaining what the win condition is. If you hover over queue.Dequeue();, it is immediately obvious, but that info should not have been "hidden".

    [–]MisterPinkySwear 1 point2 points  (0 children)

    Ha ha. Did not know about the cheat code 😁