Changeset 048cd69 in mainline for uspace/lib/c/generic/fibril_synch.c
- Timestamp:
- 2015-06-07T15:41:04Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 204ba47
- Parents:
- 4d11204 (diff), c3f7d37 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/fibril_synch.c
r4d11204 r048cd69 461 461 if (rc == ETIMEOUT && timer->state == fts_active) { 462 462 timer->state = fts_fired; 463 timer->handler_ running = true;463 timer->handler_fid = fibril_get_id(); 464 464 fibril_mutex_unlock(timer->lockp); 465 465 timer->fun(timer->arg); 466 466 fibril_mutex_lock(timer->lockp); 467 timer->handler_ running = false;467 timer->handler_fid = 0; 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); 479 480 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); 527 531 fibril_mutex_unlock(timer->lockp); 532 533 free(timer); 528 534 } 529 535 … … 608 614 assert(fibril_mutex_is_locked(timer->lockp)); 609 615 610 while (timer->handler_running) 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 611 626 fibril_condvar_wait(&timer->cv, timer->lockp); 627 } 612 628 613 629 old_state = timer->state;
Note:
See TracChangeset
for help on using the changeset viewer.