Changeset 5ee4266 in mainline
- Timestamp:
- 2018-03-11T07:35:05Z (7 years ago)
- Children:
- 58290b05
- Parents:
- b131ef3
- git-author:
- Jakub Jermar <jakub@…> (2018-03-04 11:56:50)
- git-committer:
- Jakub Jermar <jakub@…> (2018-03-11 07:35:05)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ipc.c
rb131ef3 r5ee4266 753 753 } 754 754 755 static bool phone_cap_wait_cb(cap_t *cap, void *arg)756 {757 phone_t *phone = cap->kobject->phone;758 bool *restart = (bool *) arg;759 760 mutex_lock(&phone->lock);761 762 /*763 * We might have had some IPC_PHONE_CONNECTING phones at the beginning764 * of ipc_cleanup(). Depending on whether these were forgotten or765 * answered, they will eventually enter the IPC_PHONE_FREE or766 * IPC_PHONE_CONNECTED states, respectively. In the latter case, the767 * other side may slam the open phones at any time, in which case we768 * will get an IPC_PHONE_SLAMMED phone.769 */770 if ((phone->state == IPC_PHONE_CONNECTED) ||771 (phone->state == IPC_PHONE_SLAMMED)) {772 mutex_unlock(&phone->lock);773 ipc_phone_hangup(phone);774 /*775 * Now there may be one extra active call, which needs to be776 * forgotten.777 */778 ipc_forget_all_active_calls();779 *restart = true;780 return false;781 }782 783 /*784 * If the hangup succeeded, it has sent a HANGUP message, the IPC is now785 * in HUNGUP state, we wait for the reply to come786 */787 if (phone->state != IPC_PHONE_FREE) {788 mutex_unlock(&phone->lock);789 return false;790 }791 792 mutex_unlock(&phone->lock);793 return true;794 }795 796 755 /** Wait for all answers to asynchronous calls to arrive. */ 797 756 static void ipc_wait_for_all_answered_calls(void) 798 757 { 799 758 call_t *call; 800 bool restart;801 759 802 760 restart: 803 /* 804 * Go through all phones, until they are all free. 805 */ 806 restart = false; 807 if (caps_apply_to_kobject_type(TASK, KOBJECT_TYPE_PHONE, 808 phone_cap_wait_cb, &restart) && 809 atomic_get(&TASK->answerbox.active_calls) == 0) { 761 if (atomic_get(&TASK->answerbox.active_calls) == 0) { 810 762 /* Got into cleanup */ 811 763 return; 812 764 } 813 if (restart)814 goto restart;815 765 816 766 call = ipc_wait_for_call(&TASK->answerbox, SYNCH_NO_TIMEOUT,
Note:
See TracChangeset
for help on using the changeset viewer.