Changeset 1c635d6 in mainline for uspace/app/vlaunch/vlaunch.c


Ignore:
Timestamp:
2014-08-26T15:12:12Z (9 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
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/app/vlaunch/vlaunch.c

    rdf7f5cea r1c635d6  
    9494       
    9595        task_id_t id;
    96         int rc = task_spawnl(&id, app, app, winreg, NULL);
     96        task_wait_t wait;
     97        int rc = task_spawnl(&id, &wait, app, app, winreg, NULL);
    9798        if (rc != EOK) {
    9899                printf("%s: Error spawning %s %s (%s)\n", NAME, app,
     
    103104        task_exit_t texit;
    104105        int retval;
    105         rc = task_wait(id, &texit, &retval);
     106        rc = task_wait(&wait, &texit, &retval);
    106107        if ((rc != EOK) || (texit != TASK_EXIT_NORMAL)) {
    107108                printf("%s: Error retrieving retval from %s (%s)\n", NAME,
Note: See TracChangeset for help on using the changeset viewer.