Subversion Repositories HelenOS-historic

Rev

Rev 107 | Rev 430 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 107 Rev 413
Line 62... Line 62...
62
 * @return New task's structure on success, NULL on failure.
62
 * @return New task's structure on success, NULL on failure.
63
 *
63
 *
64
 */
64
 */
65
task_t *task_create(vm_t *m)
65
task_t *task_create(vm_t *m)
66
{
66
{
67
    pri_t pri;
67
    ipl_t ipl;
68
    task_t *ta;
68
    task_t *ta;
69
   
69
   
70
    ta = (task_t *) malloc(sizeof(task_t));
70
    ta = (task_t *) malloc(sizeof(task_t));
71
    if (ta) {
71
    if (ta) {
72
        spinlock_initialize(&ta->lock);
72
        spinlock_initialize(&ta->lock);
73
        list_initialize(&ta->th_head);
73
        list_initialize(&ta->th_head);
74
        list_initialize(&ta->tasks_link);
74
        list_initialize(&ta->tasks_link);
75
        ta->vm = m;
75
        ta->vm = m;
76
       
76
       
77
        pri = cpu_priority_high();
77
        ipl = interrupts_disable();
78
        spinlock_lock(&tasks_lock);
78
        spinlock_lock(&tasks_lock);
79
        list_append(&ta->tasks_link, &tasks_head);
79
        list_append(&ta->tasks_link, &tasks_head);
80
        spinlock_unlock(&tasks_lock);
80
        spinlock_unlock(&tasks_lock);
81
        cpu_priority_restore(pri);
81
        interrupts_restore(ipl);
82
    }
82
    }
83
    return ta;
83
    return ta;
84
}
84
}
85
 
85