Changeset ce862ac in mainline for uspace/app/terminal/terminal.c


Ignore:
Timestamp:
2021-11-02T18:49:52Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b48e680f
Parents:
24c452b3
Message:

Terminate terminal if the child task has terminated

Try saying that three times quickly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/terminal/terminal.c

    r24c452b3 rce862ac  
    4141#include <fbfont/font-8x16.h>
    4242#include <io/chargrid.h>
     43#include <fibril.h>
    4344#include <gfx/bitmap.h>
    4445#include <gfx/context.h>
     
    128129};
    129130
     131static errno_t terminal_wait_fibril(void *);
     132
    130133static terminal_t *srv_to_terminal(con_srv_t *srv)
    131134{
     
    133136}
    134137
    135 static void getterm(const char *svc, const char *app)
    136 {
    137         task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
     138static errno_t getterm(task_wait_t *wait, const char *svc, const char *app)
     139{
     140        return task_spawnl(NULL, wait, APP_GETTERM, APP_GETTERM, svc,
    138141            LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL);
    139142}
     
    804807        terminal_t *term = (terminal_t *) arg;
    805808
    806         (void) term;
    807 
    808         // XXX This is not really a clean way of terminating
    809         exit(0);
     809        ui_quit(term->ui);
    810810}
    811811
     
    10141014
    10151015        list_append(&term->link, &terms);
    1016         getterm(vc, command);
     1016        rc = getterm(&term->wait, vc, command);
     1017        if (rc != EOK)
     1018                goto error;
     1019
     1020        term->wfid = fibril_create(terminal_wait_fibril, term);
     1021        if (term->wfid == 0)
     1022                goto error;
     1023
     1024        fibril_add_ready(term->wfid);
    10171025
    10181026        term->is_focused = true;
     
    10401048}
    10411049
     1050static errno_t terminal_wait_fibril(void *arg)
     1051{
     1052        terminal_t *term = (terminal_t *)arg;
     1053        task_exit_t texit;
     1054        int retval;
     1055
     1056        /*
     1057         * XXX There is no way to break the sleep if the task does not
     1058         * exit.
     1059         */
     1060        (void) task_wait(&term->wait, &texit, &retval);
     1061        ui_quit(term->ui);
     1062        return EOK;
     1063}
     1064
    10421065/** @}
    10431066 */
Note: See TracChangeset for help on using the changeset viewer.