| 159 | == Notes == |
| 160 | |
| 161 | === Deadlock When Synchronizing to More Than One External Locks === #deadlock-externals |
| 162 | |
| 163 | Adding more than one external locks to a group lock may introduce deadlock potential. Consider the following example. |
| 164 | |
| 165 | 1. External lock EA and EB (read: external A and B) are added to group lock G, resulting in group lock's chain: {{{ {EA --> EB --> G} }}} |
| 166 | 2. Thread 1 locks EA then G. The lock order then is: {{{ EA --> { EA --> EB --> G } }}} |
| 167 | 3. Thread 2 locks EB then G. The lock order then is: {{{ EB --> { EA --> EB --> G } }}} |
| 168 | 4. The lock orders in 2 and 3 are not uniform, potentially causing deadlock. |
| 169 | |
| 170 | |
| 171 | |
| 172 | |