Rev 3494 | Rev 3496 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3494 | Rev 3495 | ||
---|---|---|---|
Line 138... | Line 138... | ||
138 | spinlock_lock(&TASK->lock); |
138 | spinlock_lock(&TASK->lock); |
139 | spinlock_lock(&TASK->answerbox.lock); |
139 | spinlock_lock(&TASK->answerbox.lock); |
140 | if (list_empty(&TASK->answerbox.connected_phones)) { |
140 | if (list_empty(&TASK->answerbox.connected_phones)) { |
141 | /* |
141 | /* |
142 | * Last phone has been disconnected. |
142 | * Last phone has been disconnected. |
- | 143 | * Detach this thread so it gets |
|
- | 144 | * freed and terminate. |
|
143 | */ |
145 | */ |
144 | 146 | ||
- | 147 | /* Only need to detach thread unless already terminating. */ |
|
- | 148 | mutex_lock(&TASK->kb_cleanup_lock); |
|
- | 149 | if (&TASK->kb_finished == false) { |
|
145 | /* Detach thread so it gets freed. */ |
150 | /* Detach thread so it gets freed. */ |
146 | thread_detach(TASK->kb_thread); |
151 | thread_detach(TASK->kb_thread); |
147 | TASK->kb_thread = NULL; |
152 | TASK->kb_thread = NULL; |
- | 153 | } |
|
- | 154 | mutex_unlock(&TASK->kb_cleanup_lock); |
|
148 | done = true; |
155 | done = true; |
149 | LOG("phone list is empty\n"); |
156 | LOG("phone list is empty\n"); |
150 | } |
157 | } |
151 | spinlock_unlock(&TASK->answerbox.lock); |
158 | spinlock_unlock(&TASK->answerbox.lock); |
152 | spinlock_unlock(&TASK->lock); |
159 | spinlock_unlock(&TASK->lock); |