Changeset ff48a15 in mainline
- Timestamp:
- 2008-05-28T20:47:45Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 33c058d3
- Parents:
- 10ef329a
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
r10ef329a rff48a15 206 206 #define IPC_MAX_PHONES 16 207 207 208 #include <synch/spinlock.h> 209 #include <synch/mutex.h> 208 210 #include <synch/waitq.h> 209 211 … … 226 228 /** Structure identifying phone (in TASK structure) */ 227 229 typedef struct { 228 SPINLOCK_DECLARE(lock);230 mutex_t lock; 229 231 link_t link; 230 232 struct answerbox *callee; -
kernel/generic/src/ipc/ipc.c
r10ef329a rff48a15 38 38 */ 39 39 40 #include <synch/synch.h> 40 41 #include <synch/spinlock.h> 42 #include <synch/mutex.h> 41 43 #include <synch/waitq.h> 42 44 #include <synch/synch.h> … … 141 143 void ipc_phone_connect(phone_t *phone, answerbox_t *box) 142 144 { 143 spinlock_lock(&phone->lock);145 mutex_lock(&phone->lock); 144 146 145 147 phone->state = IPC_PHONE_CONNECTED; … … 150 152 spinlock_unlock(&box->lock); 151 153 152 spinlock_unlock(&phone->lock);154 mutex_unlock(&phone->lock); 153 155 } 154 156 … … 159 161 void ipc_phone_init(phone_t *phone) 160 162 { 161 spinlock_initialize(&phone->lock, "phone_lock");163 mutex_initialize(&phone->lock); 162 164 phone->callee = NULL; 163 165 phone->state = IPC_PHONE_FREE; … … 262 264 answerbox_t *box; 263 265 264 spinlock_lock(&phone->lock);266 mutex_lock(&phone->lock); 265 267 if (phone->state != IPC_PHONE_CONNECTED) { 266 spinlock_unlock(&phone->lock);268 mutex_unlock(&phone->lock); 267 269 if (call->flags & IPC_CALL_FORWARDED) { 268 270 IPC_SET_RETVAL(call->data, EFORWARD); … … 279 281 _ipc_call(phone, box, call); 280 282 281 spinlock_unlock(&phone->lock);283 mutex_unlock(&phone->lock); 282 284 return 0; 283 285 } … … 298 300 call_t *call; 299 301 300 spinlock_lock(&phone->lock);302 mutex_lock(&phone->lock); 301 303 if (phone->state == IPC_PHONE_FREE || 302 304 phone->state == IPC_PHONE_HUNGUP || 303 305 phone->state == IPC_PHONE_CONNECTING) { 304 spinlock_unlock(&phone->lock);306 mutex_unlock(&phone->lock); 305 307 return -1; 306 308 } … … 321 323 322 324 phone->state = IPC_PHONE_HUNGUP; 323 spinlock_unlock(&phone->lock);325 mutex_unlock(&phone->lock); 324 326 325 327 return 0; … … 450 452 phone = list_get_instance(TASK->answerbox.connected_phones.next, 451 453 phone_t, link); 452 if ( !spinlock_trylock(&phone->lock)) {454 if (SYNCH_FAILED(mutex_trylock(&phone->lock))) { 453 455 spinlock_unlock(&TASK->answerbox.lock); 454 456 DEADLOCK_PROBE(p_phonelck, DEADLOCK_THRESHOLD); … … 461 463 list_remove(&phone->link); 462 464 463 spinlock_unlock(&phone->lock);465 mutex_unlock(&phone->lock); 464 466 } 465 467 … … 536 538 printf("PHONE:\n"); 537 539 for (i = 0; i < IPC_MAX_PHONES; i++) { 538 spinlock_lock(&task->phones[i].lock); 540 if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) { 541 printf("%d: mutex busy\n", i); 542 continue; 543 } 539 544 if (task->phones[i].state != IPC_PHONE_FREE) { 540 545 printf("%d: ", i); … … 561 566 atomic_get(&task->phones[i].active_calls)); 562 567 } 563 spinlock_unlock(&task->phones[i].lock);568 mutex_unlock(&task->phones[i].lock); 564 569 } 565 570 … … 580 585 /* Print answerbox - calls */ 581 586 printf("ABOX - DISPATCHED CALLS:\n"); 582 for (tmp =task->answerbox.dispatched_calls.next;587 for (tmp = task->answerbox.dispatched_calls.next; 583 588 tmp != &task->answerbox.dispatched_calls; 584 589 tmp = tmp->next) { -
kernel/generic/src/ipc/sysipc.c
r10ef329a rff48a15 169 169 * not the originator 170 170 */ 171 spinlock_lock(&answer->data.phone->lock);171 mutex_lock(&answer->data.phone->lock); 172 172 spinlock_lock(&TASK->answerbox.lock); 173 173 if (answer->data.phone->state == IPC_PHONE_CONNECTED) { … … 176 176 } 177 177 spinlock_unlock(&TASK->answerbox.lock); 178 spinlock_unlock(&answer->data.phone->lock);178 mutex_unlock(&answer->data.phone->lock); 179 179 } 180 180
Note:
See TracChangeset
for help on using the changeset viewer.