יום חמישי, 6 ביוני 2013

UI reenter event deadlock

Dead locks in application are very often  related to the intersection between UI thread and BL layer threads.
Most of the UI technologies require single thread affinity to the UI  calls.so in order to update the UI  the BL threads must invoke a method through mechanism (like the control.invoke in wpf ) in order to change context to the UI context .

The following diagrams demonstrate a locking  problem that may be caused due to this :
 Capture28

1.A BLL activity wants to send update to the UI.
2.The message is send to a common point that invoke events in the UI .The common point is implemented the Front controller pattern . Often this point is protected by locking mechanism in order to void the situation were several updated are entered to the mechanism of the front controller.
3.The UI process the message and call the BL layer to help
4.The helping activity try to access the UI with result  or notification and bang a dead lock .

A lot of poor design is involved here but Its happens to me to meet several systems that implements the front controller badly and the troubles come along.

אין תגובות:

הוסף רשומת תגובה