Repository navigation
Commit 078f425
committed
Guard against re-entrant close() from within callbacks
If close() is called from an LlmCallback during generate() (same
thread, re-entrant lock acquisition), detect via getHoldCount() > 1
and throw instead of freeing native resources mid-call.
This commit was authored with the help of Claude.1 parent 841b443 commit 078f425
1 file changed
Lines changed: 5 additions & 2 deletions
File tree
- extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
204 | 203 | | |
205 | 204 | | |
206 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
207 | 210 | | |
208 | 211 | | |
209 | 212 | | |
| |||
0 commit comments