Changeset 7064e71 in mainline for uspace/lib/c/generic/thread/fibril.c


Ignore:
Timestamp:
2025-03-06T14:35:29Z (4 days ago)
Author:
Matěj Volf <git@…>
Children:
25ee7ec5
Parents:
9a41e6e
git-author:
Matěj Volf <git@…> (2025-03-05 23:09:43)
git-committer:
Matěj Volf <git@…> (2025-03-06 14:35:29)
Message:

run fibril exit hooks for main fibril as well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/thread/fibril.c

    r9a41e6e r7064e71  
    199199        if (fibril->is_freeable) {
    200200                tls_free(fibril->tcb);
    201                 list_foreach_safe(fibril->exit_hooks, cur, _next) {
    202                         fibril_hook_t *hook = list_get_instance(cur, fibril_hook_t, link);
    203                         free(hook);
    204                 }
    205201                free(fibril);
    206202        }
     
    850846}
    851847
     848void fibril_run_exit_hooks(fibril_t *f)
     849{
     850        list_foreach_safe(f->exit_hooks, cur, _next) {
     851                fibril_hook_t *hook = list_get_instance(cur, fibril_hook_t, link);
     852                list_remove(cur);
     853                hook->func();
     854                free(hook);
     855        }
     856}
     857
    852858/**
    853859 * Exit a fibril. Never returns.
     
    860866        (void) retval;
    861867
    862         list_foreach(fibril_self()->exit_hooks, link, fibril_hook_t, hook) {
    863                 hook->func();
    864         }
     868        fibril_run_exit_hooks(fibril_self());
    865869
    866870        fibril_t *f = _ready_list_pop_nonblocking(false);
Note: See TracChangeset for help on using the changeset viewer.