Changeset a064d4f in mainline


Ignore:
Timestamp:
2024-01-15T15:39:09Z (12 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.

Location:
kernel/generic/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    r5861b60 ra064d4f  
    10061006                        thread_ready(thread_ref(thread));
    10071007                        thread_join(thread);
    1008                         thread_put(thread);
    10091008                } else
    10101009                        printf("Unable to create thread for cpu%u\n", i);
  • kernel/generic/src/ipc/kbox.c

    r5861b60 ra064d4f  
    9090                LOG("Join kb.thread.");
    9191                thread_join(TASK->kb.thread);
    92                 thread_put(TASK->kb.thread);
    9392                LOG("...join done.");
    9493                TASK->kb.thread = NULL;
  • kernel/generic/src/main/kinit.c

    r5861b60 ra064d4f  
    124124                thread_ready(thread_ref(thread));
    125125                thread_join(thread);
    126                 thread_put(thread);
    127126
    128127                /*
  • kernel/generic/src/proc/scheduler.c

    r5861b60 ra064d4f  
    449449        THREAD->kcycles += get_cycle() - THREAD->last_cycle;
    450450
     451        /*
     452         * On Sparc, this saves some extra userspace state that's not
     453         * covered by context_save()/context_restore().
     454         */
    451455        after_thread_ran_arch();
    452456
  • 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.