Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 25a76ab8 in mainline for kernel/generic/src/proc/task.c


Ignore:
Timestamp:
2010-05-08T07:53:23Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
051bc69a
Parents:
6c39a907 (diff), 1317380 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/task.c

    r6c39a907 r25a76ab8  
    11/*
    2  * Copyright (c) 2001-2004 Jakub Jermar
     2 * Copyright (c) 2010 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    210210        btree_create(&ta->futexes);
    211211       
     212        /*
     213         * Get a reference to the address space.
     214         */
     215        as_hold(ta->as);
     216
    212217        ipl = interrupts_disable();
    213         atomic_inc(&as->refcount);
    214218        spinlock_lock(&tasks_lock);
    215219        ta->taskid = ++task_counter;
     
    250254         * Drop our reference to the address space.
    251255         */
    252         if (atomic_predec(&t->as->refcount) == 0)
    253                 as_destroy(t->as);
     256        as_release(t->as);
    254257       
    255258        slab_free(task_slab, t);
    256         TASK = NULL;
     259}
     260
     261/** Hold a reference to a task.
     262 *
     263 * Holding a reference to a task prevents destruction of that task.
     264 *
     265 * @param t             Task to be held.
     266 */
     267void task_hold(task_t *t)
     268{
     269        atomic_inc(&t->refcount);
     270}
     271
     272/** Release a reference to a task.
     273 *
     274 * The last one to release a reference to a task destroys the task.
     275 *
     276 * @param t             Task to be released.
     277 */
     278void task_release(task_t *t)
     279{
     280        if ((atomic_predec(&t->refcount)) == 0)
     281                task_destroy(t);
    257282}
    258283
Note: See TracChangeset for help on using the changeset viewer.