Changeset 9097c16a in mainline for kernel/generic/src/proc/task.c


Ignore:
Timestamp:
2011-02-04T13:14:14Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9e7cdf8
Parents:
11797d5 (diff), ff244e6 (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:

Merged development

File:
1 edited

Legend:

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

    r11797d5 r9097c16a  
    342342sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len)
    343343{
    344         int rc;
    345344        char namebuf[TASK_NAME_BUFLEN];
    346345       
    347346        /* Cap length of name and copy it from userspace. */
    348        
    349347        if (name_len > TASK_NAME_BUFLEN - 1)
    350348                name_len = TASK_NAME_BUFLEN - 1;
    351349       
    352         rc = copy_from_uspace(namebuf, uspace_name, name_len);
     350        int rc = copy_from_uspace(namebuf, uspace_name, name_len);
    353351        if (rc != 0)
    354352                return (sysarg_t) rc;
    355353       
    356354        namebuf[name_len] = '\0';
     355       
     356        /*
     357         * As the task name is referenced also from the
     358         * threads, lock the threads' lock for the course
     359         * of the update.
     360         */
     361       
     362        irq_spinlock_lock(&tasks_lock, true);
     363        irq_spinlock_lock(&TASK->lock, false);
     364        irq_spinlock_lock(&threads_lock, false);
     365       
     366        /* Set task name */
    357367        str_cpy(TASK->name, TASK_NAME_BUFLEN, namebuf);
     368       
     369        irq_spinlock_unlock(&threads_lock, false);
     370        irq_spinlock_unlock(&TASK->lock, false);
     371        irq_spinlock_unlock(&tasks_lock, true);
    358372       
    359373        return EOK;
     
    449463static void task_kill_internal(task_t *task)
    450464{
     465        irq_spinlock_lock(&task->lock, false);
     466        irq_spinlock_lock(&threads_lock, false);
     467       
     468        /*
     469         * Interrupt all threads.
     470         */
     471       
    451472        link_t *cur;
    452        
    453         /*
    454          * Interrupt all threads.
    455          */
    456         irq_spinlock_lock(&task->lock, false);
    457473        for (cur = task->th_head.next; cur != &task->th_head; cur = cur->next) {
    458474                thread_t *thread = list_get_instance(cur, thread_t, th_link);
     
    471487        }
    472488       
     489        irq_spinlock_unlock(&threads_lock, false);
    473490        irq_spinlock_unlock(&task->lock, false);
    474491}
Note: See TracChangeset for help on using the changeset viewer.