Changeset 1871118 in mainline for kernel/generic/src/ipc/kbox.c


Ignore:
Timestamp:
2023-02-10T22:59:11Z (15 months 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/kbox.c

    rdaadfa6 r1871118  
    9090                LOG("Join kb.thread.");
    9191                thread_join(TASK->kb.thread);
    92                 thread_detach(TASK->kb.thread);
     92                thread_put(TASK->kb.thread);
    9393                LOG("...join done.");
    9494                TASK->kb.thread = NULL;
     
    136136                /* Only detach kbox thread unless already terminating. */
    137137                if (TASK->kb.finished == false) {
    138                         /* Detach kbox thread so it gets freed from memory. */
    139                         thread_detach(TASK->kb.thread);
     138                        /* Release kbox thread so it gets freed from memory. */
     139                        thread_put(TASK->kb.thread);
    140140                        TASK->kb.thread = NULL;
    141141                }
     
    247247                }
    248248
    249                 task->kb.thread = kb_thread;
     249                task->kb.thread = thread_ref(kb_thread);
    250250                thread_ready(kb_thread);
    251251        }
Note: See TracChangeset for help on using the changeset viewer.