Changeset 33adc6ce in mainline
- Timestamp:
- 2009-11-21T10:26:29Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fd1210a
- Parents:
- c70ce74
- Location:
- kernel/generic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
rc70ce74 r33adc6ce 264 264 265 265 waitq_t wq; 266 267 /** Linkage for the list of task's synchronous answerboxes. */ 268 link_t sync_box_link; 266 269 267 270 /** Phones connected to this answerbox. */ -
kernel/generic/include/proc/task.h
rc70ce74 r33adc6ce 98 98 */ 99 99 atomic_t active_calls; 100 /** List of synchronous answerboxes. */ 101 link_t sync_box_head; 100 102 101 103 #ifdef CONFIG_UDEBUG -
kernel/generic/src/ipc/ipc.c
rc70ce74 r33adc6ce 119 119 spinlock_initialize(&box->irq_lock, "ipc_box_irqlock"); 120 120 waitq_initialize(&box->wq); 121 link_initialize(&box->sync_box_link); 121 122 list_initialize(&box->connected_phones); 122 123 list_initialize(&box->calls); … … 169 170 { 170 171 answerbox_t *sync_box; 172 ipl_t ipl; 171 173 172 174 sync_box = slab_alloc(ipc_answerbox_slab, 0); 173 175 ipc_answerbox_init(sync_box, TASK); 176 177 /* 178 * Put the answerbox on the TASK's list of synchronous answerboxes so 179 * that it can be cleaned up if the call is interrupted. 180 */ 181 ipl = interrupts_disable(); 182 spinlock_lock(&TASK->lock); 183 list_append(&sync_box->sync_box_link, &TASK->sync_box_head); 184 spinlock_unlock(&TASK->lock); 185 interrupts_restore(ipl); 174 186 175 187 /* We will receive data in a special box. */ … … 179 191 if (!ipc_wait_for_call(sync_box, SYNCH_NO_TIMEOUT, 180 192 SYNCH_FLAGS_INTERRUPTIBLE)) { 181 /* The a snwerbox will be freed by someone else. */193 /* The answerbox and the call will be freed by ipc_cleanup(). */ 182 194 return EINTR; 183 195 } 196 197 /* 198 * The answer arrived without interruption so we can remove the 199 * answerbox from the TASK's list of synchronous answerboxes. 200 */ 201 (void) interrupts_disable(); 202 spinlock_lock(&TASK->lock); 203 list_remove(&sync_box->sync_box_link); 204 spinlock_unlock(&TASK->lock); 205 interrupts_restore(ipl); 206 184 207 slab_free(ipc_answerbox_slab, sync_box); 185 208 return EOK; … … 513 536 int i; 514 537 call_t *call; 538 ipl_t ipl; 515 539 516 540 /* Disconnect all our phones ('ipc_phone_hangup') */ … … 538 562 spinlock_unlock(&TASK->answerbox.lock); 539 563 540 /* Wait for all async answers to arrive */ 564 /* Wait for all answers to interrupted synchronous calls to arrive */ 565 ipl = interrupts_disable(); 566 while (!list_empty(&TASK->sync_box_head)) { 567 answerbox_t *box = list_get_instance(TASK->sync_box_head.next, 568 answerbox_t, sync_box_link); 569 570 list_remove(&box->sync_box_link); 571 call = ipc_wait_for_call(box, SYNCH_NO_TIMEOUT, 572 SYNCH_FLAGS_NONE); 573 ipc_call_free(call); 574 slab_free(ipc_answerbox_slab, box); 575 } 576 interrupts_restore(ipl); 577 578 /* Wait for all answers to asynchronous calls to arrive */ 541 579 while (1) { 542 580 /* Go through all phones, until all are FREE... */ -
kernel/generic/src/ipc/sysipc.c
rc70ce74 r33adc6ce 559 559 #endif 560 560 if (rc != EOK) { 561 /* The call will be freed by someone else. */561 /* The call will be freed by ipc_cleanup(). */ 562 562 return rc; 563 563 } … … 612 612 #endif 613 613 if (rc != EOK) { 614 /* The call will be freed by someone else. */614 /* The call will be freed by ipc_cleanup(). */ 615 615 return rc; 616 616 } -
kernel/generic/src/proc/task.c
rc70ce74 r33adc6ce 178 178 ipc_phone_connect(&ta->phones[0], ipc_phone_0); 179 179 atomic_set(&ta->active_calls, 0); 180 list_initialize(&ta->sync_box_head); 180 181 181 182 mutex_initialize(&ta->futexes_lock, MUTEX_PASSIVE);
Note:
See TracChangeset
for help on using the changeset viewer.