Subversion Repositories HelenOS

Rev

Rev 814 | Rev 955 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 814 Rev 822
Line 62... Line 62...
62
task_t *task_create(as_t *as)
62
task_t *task_create(as_t *as)
63
{
63
{
64
    ipl_t ipl;
64
    ipl_t ipl;
65
    task_t *ta;
65
    task_t *ta;
66
   
66
   
67
    ta = (task_t *) malloc(sizeof(task_t));
67
    ta = (task_t *) malloc(sizeof(task_t), 0);
68
    if (ta) {
68
 
69
        spinlock_initialize(&ta->lock, "task_ta_lock");
69
    spinlock_initialize(&ta->lock, "task_ta_lock");
70
        list_initialize(&ta->th_head);
70
    list_initialize(&ta->th_head);
71
        list_initialize(&ta->tasks_link);
71
    list_initialize(&ta->tasks_link);
72
        ta->as = as;
72
    ta->as = as;
73
       
73
   
74
        ipl = interrupts_disable();
74
    ipl = interrupts_disable();
75
        spinlock_lock(&tasks_lock);
75
    spinlock_lock(&tasks_lock);
76
        list_append(&ta->tasks_link, &tasks_head);
76
    list_append(&ta->tasks_link, &tasks_head);
77
        spinlock_unlock(&tasks_lock);
77
    spinlock_unlock(&tasks_lock);
78
        interrupts_restore(ipl);
78
    interrupts_restore(ipl);
79
    }
79
 
80
    return ta;
80
    return ta;
81
}
81
}
82
 
82