Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1339
RowsCollection.SyncRows() Protected Against Multiple Threads?
posted

I'm trying to wrap my head around the "asyncronous-ness" of the WinGrid (putting off actions by marking things dirty, etc) and was confused by a particular method.

It is my understanding that nothing internal in the WinGrid is done on any thread other than the UI thread, which seems contradicted by the design of the SyncRows() method in Infragistics.Win.UltraWinGrid.RowsCollection.

First, there is a boolean member in the class to track when the SyncRows method is being executed (inSyncRows) to prevent execution of the method if the method is already executing.  This purpose is explained by a lengthy comment about timer ticks overlapping, which also didn't make any sense (if all the timers are form timers then it should be a single file line of messages on the pump to be processed...you can't have overlapping execution).

Second, a lock statement is used in the middle of the method (this is the only place I saw a lock statement used in the entire assembly).  There is no other reason for a lock statement other than single thread restriction in a multi threaded application.

Is there some kind of black magic going on here or is this just unnecessary legacy code?

Thanks!