diff options
| author | geniusgogo <[email protected]> | 2023-08-12 10:50:45 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-12 10:50:45 +0800 |
| commit | a6959a9ef8a8b3233a2d0b395d43f07711bf765c (patch) | |
| tree | e70d4dca6ac7082a05d5d01af4aed4b9383ddb33 /components | |
| parent | 1b5ed06d38f77abeaa0fb835c813940729cf613f (diff) | |
fix lwp_free tty switch to foreground error (#7945)
Diffstat (limited to 'components')
| -rw-r--r-- | components/lwp/lwp_pid.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/components/lwp/lwp_pid.c b/components/lwp/lwp_pid.c index 79f4e2ec0f..38d068ee0a 100644 --- a/components/lwp/lwp_pid.c +++ b/components/lwp/lwp_pid.c @@ -469,13 +469,18 @@ void lwp_free(struct rt_lwp* lwp) if (lwp->tty != RT_NULL) { rt_mutex_take(&lwp->tty->lock, RT_WAITING_FOREVER); - old_lwp = tty_pop(&lwp->tty->head, RT_NULL); - rt_mutex_release(&lwp->tty->lock); if (lwp->tty->foreground == lwp) { + old_lwp = tty_pop(&lwp->tty->head, RT_NULL); lwp->tty->foreground = old_lwp; - lwp->tty = RT_NULL; } + else + { + tty_pop(&lwp->tty->head, lwp); + } + rt_mutex_release(&lwp->tty->lock); + + lwp->tty = RT_NULL; } } else |
