Changeset 1871118 in mainline for kernel/generic/src/main


Ignore:
Timestamp:
2023-02-10T22:59:11Z (3 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
11d2c983
Parents:
daadfa6
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-10 22:53:12)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-10 22:59:11)
Message:

Make thread_t reference counted

This simplifies interaction between various locks and thread
lifespan, which simplifies things. For example, threads_lock can
now simply be a mutex protecting the global it was made for, and
nothing more.

Location:
kernel/generic/src/main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/kinit.c

    rdaadfa6 r1871118  
    102102        thread_t *thread;
    103103
    104         /*
    105          * Detach kinit as nobody will call thread_join_timeout() on it.
    106          */
    107         thread_detach(THREAD);
    108 
    109104        interrupts_disable();
    110105
     
    125120
    126121                thread_wire(thread, &cpus[0]);
    127                 thread_ready(thread);
     122                thread_ready(thread_ref(thread));
    128123                thread_join(thread);
    129                 thread_detach(thread);
     124                thread_put(thread);
    130125
    131126                /*
  • kernel/generic/src/main/uinit.c

    rdaadfa6 r1871118  
    5656void uinit(void *arg)
    5757{
    58         /*
    59          * So far, we don't have a use for joining userspace threads so we
    60          * immediately detach each uinit thread. If joining of userspace threads
    61          * is required, some userspace API based on the kernel mechanism will
    62          * have to be implemented. Moreover, garbage collecting of threads that
    63          * didn't detach themselves and nobody else joined them will have to be
    64          * deployed for the event of forceful task termination.
    65          */
    66         thread_detach(THREAD);
    67 
    6858#ifdef CONFIG_UDEBUG
    6959        udebug_stoppable_end();
Note: See TracChangeset for help on using the changeset viewer.