Commit 33d3832
committed
swap: Don't defer mutex unlock in a loop.
Using defer to unlock the mutex means that the mutex can be locked
repeatedly during the loop and only unlocked when the function returns,
rather than being unlocked at the end of the current loop iteration.
This can lead to the mutex being held for longer than required.1 parent 94ca39a commit 33d3832
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1103 | 1103 | | |
1104 | 1104 | | |
1105 | 1105 | | |
1106 | | - | |
1107 | 1106 | | |
1108 | 1107 | | |
1109 | 1108 | | |
1110 | 1109 | | |
| 1110 | + | |
1111 | 1111 | | |
1112 | 1112 | | |
1113 | 1113 | | |
| |||
1118 | 1118 | | |
1119 | 1119 | | |
1120 | 1120 | | |
| 1121 | + | |
1121 | 1122 | | |
1122 | 1123 | | |
1123 | 1124 | | |
| |||
1126 | 1127 | | |
1127 | 1128 | | |
1128 | 1129 | | |
| 1130 | + | |
| 1131 | + | |
1129 | 1132 | | |
1130 | 1133 | | |
1131 | 1134 | | |
| |||
0 commit comments