Changeset c33f39f in mainline for kernel/generic/src/ipc/ipc.c
- Timestamp:
- 2012-09-04T21:12:43Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 983cabe8
- Parents:
- 2541646
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ipc.c
r2541646 rc33f39f 137 137 * @param phone Initialized phone structure. 138 138 * @param box Initialized answerbox structure. 139 * 140 */ 141 void ipc_phone_connect(phone_t *phone, answerbox_t *box) 142 { 139 * @return True if the phone was connected, false otherwise. 140 */ 141 bool ipc_phone_connect(phone_t *phone, answerbox_t *box) 142 { 143 bool active; 144 143 145 mutex_lock(&phone->lock); 144 145 phone->state = IPC_PHONE_CONNECTED;146 phone->callee = box;147 148 146 irq_spinlock_lock(&box->lock, true); 149 list_append(&phone->link, &box->connected_phones); 147 148 active = box->active; 149 if (active) { 150 phone->state = IPC_PHONE_CONNECTED; 151 phone->callee = box; 152 list_append(&phone->link, &box->connected_phones); 153 } 154 150 155 irq_spinlock_unlock(&box->lock, true); 151 152 156 mutex_unlock(&phone->lock); 157 158 return active; 153 159 } 154 160 … … 684 690 void ipc_cleanup(void) 685 691 { 692 /* 693 * Mark the answerbox as inactive. 694 * 695 * The main purpose for doing this is to prevent any pending callback 696 * connections from getting established beyond this point. 697 */ 698 irq_spinlock_lock(&TASK->answerbox.lock, true); 699 TASK->answerbox.active = false; 700 irq_spinlock_unlock(&TASK->answerbox.lock, true); 701 686 702 /* Disconnect all our phones ('ipc_phone_hangup') */ 687 703 for (size_t i = 0; i < IPC_MAX_PHONES; i++)
Note:
See TracChangeset
for help on using the changeset viewer.