Skip to main content

Practice · 4 of 4

Atomic Visitor Counts

CHALLENGE
Difficulty: intermediate+25 XP

Implement VisitorStats on a ConcurrentDictionary: RecordVisit returns the count AFTER this visit (first visit returns 1), Visits returns the current count. ``csharp public sealed class VisitorStats { public int RecordVisit(string path); // atomic; returns post-visit count public int Visits(string path); // 0 for unknown paths } ``

Back to lesson: Practice: Concurrency Practice: Counters, Limits, Deadlocks