Skip to main content

Practice ยท 3 of 4

Debug: The Transfer That Freezes

CHALLENGE
Difficulty: intermediate+25 XP

Transfer must call CjConcurrency.Pause() AFTER acquiring its first lock and BEFORE the second (a simulated FX check). The current implementation deadlocks when two transfers run in opposite directions. Fix it so both transfers always complete โ€” without removing the Pause. ``csharp public sealed class Account { public int Id; public int Balance; } static void Transfer(Account from, Account to, int amount); ``

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