Changes in uspace/lib/c/generic/fibril_synch.c [5a5b087:7f9d97f3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/fibril_synch.c
r5a5b087 r7f9d97f3 461 461 if (rc == ETIMEOUT && timer->state == fts_active) { 462 462 timer->state = fts_fired; 463 timer->handler_ fid = fibril_get_id();463 timer->handler_running = true; 464 464 fibril_mutex_unlock(timer->lockp); 465 465 timer->fun(timer->arg); 466 466 fibril_mutex_lock(timer->lockp); 467 timer->handler_ fid = 0;467 timer->handler_running = false; 468 468 } 469 469 break; … … 477 477 /* Acknowledge timer fibril has finished cleanup. */ 478 478 timer->state = fts_clean; 479 fibril_condvar_broadcast(&timer->cv);480 479 fibril_mutex_unlock(timer->lockp); 480 free(timer); 481 481 482 482 return 0; … … 525 525 timer->state = fts_cleanup; 526 526 fibril_condvar_broadcast(&timer->cv); 527 528 /* Wait for timer fibril to terminate */529 while (timer->state != fts_clean)530 fibril_condvar_wait(&timer->cv, timer->lockp);531 527 fibril_mutex_unlock(timer->lockp); 532 533 free(timer);534 528 } 535 529 … … 614 608 assert(fibril_mutex_is_locked(timer->lockp)); 615 609 616 while (timer->handler_fid != 0) { 617 if (timer->handler_fid == fibril_get_id()) { 618 printf("Deadlock detected.\n"); 619 stacktrace_print(); 620 printf("Fibril %zx is trying to clear timer %p from " 621 "inside its handler %p.\n", 622 fibril_get_id(), timer, timer->fun); 623 abort(); 624 } 625 610 while (timer->handler_running) 626 611 fibril_condvar_wait(&timer->cv, timer->lockp); 627 }628 612 629 613 old_state = timer->state;
Note:
See TracChangeset
for help on using the changeset viewer.