Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 5a5b087 in mainline for uspace/lib/c/generic/fibril_synch.c


Ignore:
Timestamp:
2015-06-07T12:13:42Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
c3f7d37
Parents:
8dc9b72
Message:

Cannot free timer memory from timer fibril. Since timer→lockp can point to user-provided lock which may not exist beyond return from fibril_timer_destroy(), fibril_timer_destroy() must wait for timer fibril to terminate.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/fibril_synch.c

    r8dc9b72 r5a5b087  
    477477        /* Acknowledge timer fibril has finished cleanup. */
    478478        timer->state = fts_clean;
     479        fibril_condvar_broadcast(&timer->cv);
    479480        fibril_mutex_unlock(timer->lockp);
    480         free(timer);
    481481
    482482        return 0;
     
    525525        timer->state = fts_cleanup;
    526526        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);
    527531        fibril_mutex_unlock(timer->lockp);
     532
     533        free(timer);
    528534}
    529535
Note: See TracChangeset for help on using the changeset viewer.