Changeset 0f4f1b2 in mainline for kernel/generic/src/proc/thread.c


Ignore:
Timestamp:
2024-01-15T17:10:27Z (18 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/proc/thread.c

    ra064d4f r0f4f1b2  
    234234}
    235235
     236/** Start a thread that wasn't started yet since it was created.
     237 *
     238 * @param thread A reference to the newly created thread.
     239 */
     240void thread_start(thread_t *thread)
     241{
     242        assert(thread->state == Entering);
     243        thread_ready(thread_ref(thread));
     244}
     245
    236246/** Make thread ready
    237247 *
     
    696706errno_t thread_join_timeout(thread_t *thread, uint32_t usec, unsigned int flags)
    697707{
     708        assert(thread != NULL);
     709
    698710        if (thread == THREAD)
    699711                return EINVAL;
     
    712724
    713725        return rc;
     726}
     727
     728void thread_detach(thread_t *thread)
     729{
     730        thread_put(thread);
    714731}
    715732
Note: See TracChangeset for help on using the changeset viewer.