I assume that code in NinjaTrader locks on this collection whenever it is adding/removing positions from the collection. I also need to iterate over all the positions but I want it do it from an event handler connectioned to Account.PositionUpdate.
How do I know that NinjaTrader will never have already acquired a lock on this collection when it calls my event handler? If there is some condition for which this event handler could be called with the lock already in place then the code will deadlock.
Comment