Changeset 70327bb in mainline


Ignore:
Timestamp:
2018-03-13T18:01:47Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e618885
Parents:
c25a39e
git-author:
Jakub Jermar <jakub@…> (2018-03-04 11:18:52)
git-committer:
Jakub Jermar <jakub@…> (2018-03-13 18:01:47)
Message:

Track number of answers expected by answerbox

Location:
kernel/generic
Files:
2 edited

Legend:

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

    rc25a39e r70327bb  
    8282        waitq_t wq;
    8383
     84        /**
     85         * Number of answers the answerbox is expecting to eventually arrive.
     86         */
     87        atomic_t active_calls;
     88
    8489        /** Phones connected to this answerbox. */
    8590        list_t connected_phones;
  • kernel/generic/src/ipc/ipc.c

    rc25a39e r70327bb  
    147147        list_initialize(&box->answers);
    148148        list_initialize(&box->irq_notifs);
     149        atomic_set(&box->active_calls, 0);
    149150        box->task = task;
    150151}
     
    350351        } else {
    351352                atomic_inc(&phone->active_calls);
     353                atomic_inc(&caller->answerbox.active_calls);
    352354                kobject_add_ref(phone->kobject);
    353355                call->sender = caller;
     
    564566                list_remove(&request->ab_link);
    565567                atomic_dec(&request->caller_phone->active_calls);
     568                atomic_dec(&box->active_calls);
    566569                kobject_put(request->caller_phone->kobject);
    567570        } else if (!list_empty(&box->calls)) {
     
    709712
    710713        atomic_dec(&call->caller_phone->active_calls);
     714        atomic_dec(&TASK->answerbox.active_calls);
    711715        kobject_put(call->caller_phone->kobject);
    712716
     
    799803        /*
    800804         * Go through all phones, until they are all free.
    801          * Locking is needed as there may be connection handshakes in progress.
    802805         */
    803806        restart = false;
    804807        if (caps_apply_to_kobject_type(TASK, KOBJECT_TYPE_PHONE,
    805             phone_cap_wait_cb, &restart)) {
     808            phone_cap_wait_cb, &restart) &&
     809            atomic_get(&TASK->answerbox.active_calls) == 0) {
    806810                /* Got into cleanup */
    807811                return;
Note: See TracChangeset for help on using the changeset viewer.