Changeset 55bd76c in mainline
- Timestamp:
- 2010-11-05T16:15:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9414abc, a66e2993
- Parents:
- 649efcd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/fibril_synch.c
r649efcd r55bd76c 58 58 } 59 59 60 static bool check_for_deadlock(fibril_owner_info_t *oi)61 {62 while (oi && oi->owned_by) {63 if (oi->owned_by == (fibril_t *) fibril_get_id())64 return true;65 oi = oi->owned_by->waits_for;66 }67 68 return false;69 }70 71 60 static void print_deadlock(fibril_owner_info_t *oi) 72 61 { … … 89 78 oi = oi->owned_by->waits_for; 90 79 } 91 92 abort(); 93 } 80 } 81 82 83 static void check_for_deadlock(fibril_owner_info_t *oi) 84 { 85 while (oi && oi->owned_by) { 86 if (oi->owned_by == (fibril_t *) fibril_get_id()) { 87 print_deadlock(oi); 88 abort(); 89 } 90 oi = oi->owned_by->waits_for; 91 } 92 } 93 94 94 95 95 void fibril_mutex_initialize(fibril_mutex_t *fm) … … 113 113 link_initialize(&wdata.wu_event.link); 114 114 list_append(&wdata.wu_event.link, &fm->waiters); 115 116 if (check_for_deadlock(&fm->oi)) 117 print_deadlock(&fm->oi); 115 check_for_deadlock(&fm->oi); 118 116 f->waits_for = &fm->oi; 119 120 117 fibril_switch(FIBRIL_TO_MANAGER); 121 118 } else { … … 194 191 f->flags &= ~FIBRIL_WRITER; 195 192 list_append(&wdata.wu_event.link, &frw->waiters); 196 197 if (check_for_deadlock(&frw->oi)) 198 print_deadlock(&frw->oi); 193 check_for_deadlock(&frw->oi); 199 194 f->waits_for = &frw->oi; 200 201 195 fibril_switch(FIBRIL_TO_MANAGER); 202 196 } else { … … 220 214 f->flags |= FIBRIL_WRITER; 221 215 list_append(&wdata.wu_event.link, &frw->waiters); 222 223 if (check_for_deadlock(&frw->oi)) 224 print_deadlock(&frw->oi); 216 check_for_deadlock(&frw->oi); 225 217 f->waits_for = &frw->oi; 226 227 218 fibril_switch(FIBRIL_TO_MANAGER); 228 219 } else {
Note:
See TracChangeset
for help on using the changeset viewer.