Changeset 7064e71 in mainline for uspace/lib/c/generic
- Timestamp:
- 2025-03-06T14:35:29Z (10 months ago)
- 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)
- Location:
- uspace/lib/c/generic
- Files:
-
- 3 edited
-
libc.c (modified) (2 diffs)
-
private/fibril.h (modified) (1 diff)
-
thread/fibril.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/libc.c
r9a41e6e r7064e71 81 81 main_fibril.tcb = tls_make_initial(__progsymbols.elfstart); 82 82 } 83 main_fibril.is_freeable = false; 83 84 84 85 assert(main_fibril.tcb); … … 172 173 void __libc_exit(int status) 173 174 { 174 // TODO: some teardown of the main fibril? 175 // namely, fibril_exit_hooks would like to run even on the main fibril 175 fibril_run_exit_hooks(&main_fibril); 176 176 177 177 /* -
uspace/lib/c/generic/private/fibril.h
r9a41e6e r7064e71 94 94 extern void fibril_ipc_poke(void); 95 95 96 extern void fibril_run_exit_hooks(fibril_t *); 97 96 98 /** 97 99 * "Restricted" fibril mutex. -
uspace/lib/c/generic/thread/fibril.c
r9a41e6e r7064e71 199 199 if (fibril->is_freeable) { 200 200 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 }205 201 free(fibril); 206 202 } … … 850 846 } 851 847 848 void 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 852 858 /** 853 859 * Exit a fibril. Never returns. … … 860 866 (void) retval; 861 867 862 list_foreach(fibril_self()->exit_hooks, link, fibril_hook_t, hook) { 863 hook->func(); 864 } 868 fibril_run_exit_hooks(fibril_self()); 865 869 866 870 fibril_t *f = _ready_list_pop_nonblocking(false);
Note:
See TracChangeset
for help on using the changeset viewer.
