Changeset 0f4f1b2 in mainline for kernel/generic/src/main/kinit.c


Ignore:
Timestamp:
2024-01-15T17:10:27Z (16 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
e82879c
Parents:
a064d4f
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-15 16:37:22)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-15 17:10:27)
Message:

Add (and use) functions thread_start() and thread_detach()

Mostly cosmetic, with thread_start() replacing calls to thread_ready(),
but not consuming the passed reference, and thread_detach() being
synonym for thread_put(). Makes the code's function more obvious.

Also modify some threaded tests to use thread_join() for waiting,
instead of counting threads with atomics or semaphores.

File:
1 edited

Legend:

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

    ra064d4f r0f4f1b2  
    122122
    123123                thread_wire(thread, &cpus[0]);
    124                 thread_ready(thread_ref(thread));
     124                thread_start(thread);
    125125                thread_join(thread);
    126126
     
    135135                        if (thread != NULL) {
    136136                                thread_wire(thread, &cpus[i]);
    137                                 thread_ready(thread);
     137                                thread_start(thread);
     138                                thread_detach(thread);
    138139                        } else
    139140                                log(LF_OTHER, LVL_ERROR,
     
    151152        thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE,
    152153            "kload");
    153         if (thread != NULL)
    154                 thread_ready(thread);
    155         else
     154        if (thread != NULL) {
     155                thread_start(thread);
     156                thread_detach(thread);
     157        } else {
    156158                log(LF_OTHER, LVL_ERROR, "Unable to create kload thread");
     159        }
    157160
    158161#ifdef CONFIG_KCONSOLE
     
    163166                thread = thread_create(kconsole_thread, NULL, TASK,
    164167                    THREAD_FLAG_NONE, "kconsole");
    165                 if (thread != NULL)
    166                         thread_ready(thread);
    167                 else
     168                if (thread != NULL) {
     169                        thread_start(thread);
     170                        thread_detach(thread);
     171                } else {
    168172                        log(LF_OTHER, LVL_ERROR,
    169173                            "Unable to create kconsole thread");
     174                }
    170175        }
    171176#endif /* CONFIG_KCONSOLE */
Note: See TracChangeset for help on using the changeset viewer.