Changeset 1c635d6 in mainline for uspace/srv/hid/remcons/remcons.c


Ignore:
Timestamp:
2014-08-26T15:12:12Z (10 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
613d644
Parents:
df7f5cea
Message:

Do not hold a task's return value after it has disconnected.

Holding the task's return value meant that if nobody waited
for task's result, it polluted NS's memory. This was apparently
done because of a race between spawning a task and waiting for it.

We solve this problem in another way: ns discards the return value
as soon as the task disconnects from it. This typically happens
when the task finishes its execution. In order to avoid the race,
we send the wait request to ns while spawning the task (i.e. when
we talk to the loader), but before we allow the loaded program
to run.

Fixes #132

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/remcons/remcons.c

    rdf7f5cea r1c635d6  
    226226       
    227227        task_id_t task;
    228         int rc = task_spawnl(&task, APP_GETTERM, APP_GETTERM, user->service_name,
     228        task_wait_t wait;
     229        int rc = task_spawnl(&task, &wait, APP_GETTERM, APP_GETTERM, user->service_name,
    229230            "/loc", "--msg", "--", APP_SHELL, NULL);
    230231        if (rc != EOK) {
     
    246247        task_exit_t task_exit;
    247248        int task_retval;
    248         task_wait(task, &task_exit, &task_retval);
     249        task_wait(&wait, &task_exit, &task_retval);
    249250        telnet_user_log(user, "%s terminated %s, exit code %d.", APP_GETTERM,
    250251            task_exit == TASK_EXIT_NORMAL ? "normally" : "unexpectedly",
Note: See TracChangeset for help on using the changeset viewer.