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


Ignore:
Timestamp:
2024-01-15T15:39:09Z (4 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
0f4f1b2
Parents:
5861b60
Message:

Make thread_join() imply thread_put()

This makes the function more similar to traditional threading APIs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r5861b60 ra064d4f  
    685685
    686686/** Wait for another thread to exit.
    687  * This function does not destroy the thread. Reference counting handles that.
     687 * After successful wait, the thread reference is destroyed.
    688688 *
    689689 * @param thread Thread to join on exit.
     
    703703        irq_spinlock_unlock(&thread->lock, true);
    704704
    705         if (state == Exiting) {
    706                 return EOK;
    707         } else {
    708                 return _waitq_sleep_timeout(&thread->join_wq, usec, flags);
    709         }
     705        errno_t rc = EOK;
     706
     707        if (state != Exiting)
     708                rc = _waitq_sleep_timeout(&thread->join_wq, usec, flags);
     709
     710        if (rc == EOK)
     711                thread_put(thread);
     712
     713        return rc;
    710714}
    711715
Note: See TracChangeset for help on using the changeset viewer.