Changeset 1fa010c in mainline
- Timestamp:
- 2010-10-19T20:12:14Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 12c38f5
- Parents:
- 525df28
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/fibril_synch.c
r525df28 r1fa010c 42 42 #include <errno.h> 43 43 #include <assert.h> 44 #include <stacktrace.h> 45 #include <stdlib.h> 44 46 45 47 static void optimize_execution_power(void) … … 56 58 } 57 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 static void print_deadlock(fibril_owner_info_t *oi) 72 { 73 fibril_t *f = (fibril_t *) fibril_get_id(); 74 75 printf("Deadlock detected: "); 76 77 printf("Fibril %p waits for primitive %p.\n", f, oi); 78 stacktrace_print(); 79 80 while (oi && oi->owned_by) { 81 printf(". "); 82 printf("Primitive %p is owned by fibril %p.\n", 83 oi, oi->owned_by); 84 stacktrace_print_fp_pc(oi->owned_by->ctx.ebp, 85 oi->owned_by->ctx.pc); 86 if (oi->owned_by == f) 87 break; 88 printf("Fibril %p waits for primitive %p.\n", 89 oi->owned_by, oi->owned_by->waits_for); 90 oi = oi->owned_by->waits_for; 91 } 92 93 abort(); 94 } 95 58 96 void fibril_mutex_initialize(fibril_mutex_t *fm) 59 97 { … … 77 115 list_append(&wdata.wu_event.link, &fm->waiters); 78 116 117 if (check_for_deadlock(&fm->oi)) 118 print_deadlock(&fm->oi); 79 119 f->waits_for = &fm->oi; 80 120
Note:
See TracChangeset
for help on using the changeset viewer.