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

Changeset 86939b1 in mainline


Ignore:
Timestamp:
2012-08-13T14:12:19Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
1cb75de
Parents:
cfaa35a
Message:

Maintain task's active calls in the active call list.

  • The call is placed on the list when sent and removed when the answer is picked up by the task.
Location:
kernel/generic
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ipc/ipc.h

    rcfaa35a r86939b1  
    106106
    107107typedef struct {
     108        /** Task link. */
     109        link_t ta_link;
     110
    108111        /** Answerbox link. */
    109112        link_t ab_link;
  • kernel/generic/include/proc/task.h

    rcfaa35a r86939b1  
    9191       
    9292        /* IPC stuff */
    93         answerbox_t answerbox;  /**< Communication endpoint */
     93
     94        /** Receiving communication endpoint */
     95        answerbox_t answerbox;
     96
     97        /** Sending communication endpoints */
    9498        phone_t phones[IPC_MAX_PHONES];
    95         stats_ipc_t ipc_info;   /**< IPC statistics */
     99
     100        /** Spinlock protecting the active_calls list. */
     101        SPINLOCK_DECLARE(active_calls_lock);
     102
     103        /**
     104         * List of all calls sent by this task that have not yet been
     105         * answered.
     106         */
     107        list_t active_calls;
     108
    96109        event_t events[EVENT_TASK_END - EVENT_END];
     110
     111        /** IPC statistics */
     112        stats_ipc_t ipc_info;
    97113       
    98114#ifdef CONFIG_UDEBUG
  • kernel/generic/src/ipc/ipc.c

    rcfaa35a r86939b1  
    230230        call->data.phone = phone;
    231231        atomic_inc(&phone->active_calls);
     232
     233        spinlock_lock(&TASK->active_calls_lock);
     234        list_append(&call->ta_link, &TASK->active_calls);
     235        spinlock_unlock(&TASK->active_calls_lock);
     236
    232237        IPC_SET_RETVAL(call->data, err);
    233238        _ipc_answer_free_call(call, false);
     
    250255        if (!(call->flags & IPC_CALL_FORWARDED)) {
    251256                atomic_inc(&phone->active_calls);
     257
     258                spinlock_lock(&TASK->active_calls_lock);
     259                list_append(&call->ta_link, &TASK->active_calls);
     260                spinlock_unlock(&TASK->active_calls_lock);
     261
    252262                call->data.phone = phone;
    253263                call->data.task_id = TASK->taskid;
     
    419429                list_remove(&request->ab_link);
    420430                atomic_dec(&request->data.phone->active_calls);
     431
     432                /*
     433                 * Remove the call from this task's active call list.
     434                 */
     435                spinlock_lock(&TASK->active_calls_lock);
     436                list_remove(&request->ta_link);
     437                spinlock_unlock(&TASK->active_calls_lock);
    421438        } else if (!list_empty(&box->calls)) {
    422439                /* Count received call */
  • kernel/generic/src/proc/task.c

    rcfaa35a r86939b1  
    162162        for (i = 0; i < IPC_MAX_PHONES; i++)
    163163                ipc_phone_init(&task->phones[i]);
     164
     165        spinlock_initialize(&task->active_calls_lock, "active_calls_lock");
     166        list_initialize(&task->active_calls);
    164167       
    165168#ifdef CONFIG_UDEBUG
Note: See TracChangeset for help on using the changeset viewer.