Changes in uspace/lib/c/generic/fibril_synch.c [7f9d97f3:2654afb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/fibril_synch.c
r7f9d97f3 r2654afb 105 105 fibril_t *f = (fibril_t *) fibril_get_id(); 106 106 107 if (fibril_get_sercount() != 0)108 abort();109 110 107 futex_down(&async_futex); 111 108 if (fm->counter-- <= 0) { … … 197 194 fibril_t *f = (fibril_t *) fibril_get_id(); 198 195 199 if (fibril_get_sercount() != 0)200 abort();201 202 196 futex_down(&async_futex); 203 197 if (frw->writers) { … … 224 218 fibril_t *f = (fibril_t *) fibril_get_id(); 225 219 226 if (fibril_get_sercount() != 0)227 abort();228 229 220 futex_down(&async_futex); 230 221 if (frw->writers || frw->readers) { … … 461 452 if (rc == ETIMEOUT && timer->state == fts_active) { 462 453 timer->state = fts_fired; 463 timer->handler_ running = true;454 timer->handler_fid = fibril_get_id(); 464 455 fibril_mutex_unlock(timer->lockp); 465 456 timer->fun(timer->arg); 466 457 fibril_mutex_lock(timer->lockp); 467 timer->handler_ running = false;458 timer->handler_fid = 0; 468 459 } 469 460 break; … … 477 468 /* Acknowledge timer fibril has finished cleanup. */ 478 469 timer->state = fts_clean; 470 fibril_condvar_broadcast(&timer->cv); 479 471 fibril_mutex_unlock(timer->lockp); 480 free(timer);481 472 482 473 return 0; … … 525 516 timer->state = fts_cleanup; 526 517 fibril_condvar_broadcast(&timer->cv); 518 519 /* Wait for timer fibril to terminate */ 520 while (timer->state != fts_clean) 521 fibril_condvar_wait(&timer->cv, timer->lockp); 527 522 fibril_mutex_unlock(timer->lockp); 523 524 free(timer); 528 525 } 529 526 … … 608 605 assert(fibril_mutex_is_locked(timer->lockp)); 609 606 610 while (timer->handler_running) 607 while (timer->handler_fid != 0) { 608 if (timer->handler_fid == fibril_get_id()) { 609 printf("Deadlock detected.\n"); 610 stacktrace_print(); 611 printf("Fibril %zx is trying to clear timer %p from " 612 "inside its handler %p.\n", 613 fibril_get_id(), timer, timer->fun); 614 abort(); 615 } 616 611 617 fibril_condvar_wait(&timer->cv, timer->lockp); 618 } 612 619 613 620 old_state = timer->state;
Note:
See TracChangeset
for help on using the changeset viewer.