Changeset 78acbc72 in mainline


Ignore:
Timestamp:
2023-02-07T18:43:26Z (22 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ba25c4b
Parents:
0366d09d
Message:

Remove unused thread_interrupted(), make thread_interrupt() useful

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/proc/thread.h

    r0366d09d r78acbc72  
    221221extern void thread_ready(thread_t *);
    222222extern void thread_exit(void) __attribute__((noreturn));
    223 extern void thread_interrupt(thread_t *);
    224 extern bool thread_interrupted(thread_t *);
     223extern void thread_interrupt(thread_t *, bool);
    225224
    226225#ifndef thread_create_arch
  • kernel/generic/src/proc/task.c

    r0366d09d r78acbc72  
    536536
    537537        list_foreach(task->threads, th_link, thread_t, thread) {
    538                 bool sleeping = false;
    539 
    540                 irq_spinlock_lock(&thread->lock, false);
    541 
    542                 thread->interrupted = true;
    543                 if (thread->state == Sleeping)
    544                         sleeping = true;
    545 
    546                 irq_spinlock_unlock(&thread->lock, false);
    547 
    548                 if (sleeping)
    549                         waitq_interrupt_sleep(thread);
     538                thread_interrupt(thread, false);
    550539        }
    551540
  • kernel/generic/src/proc/thread.c

    r0366d09d r78acbc72  
    530530 *               will remain valid until thread_interrupt() exits.
    531531 */
    532 void thread_interrupt(thread_t *thread)
     532void thread_interrupt(thread_t *thread, bool irq_dis)
    533533{
    534534        assert(thread != NULL);
    535535
    536         irq_spinlock_lock(&thread->lock, true);
     536        irq_spinlock_lock(&thread->lock, irq_dis);
    537537
    538538        thread->interrupted = true;
    539539        bool sleeping = (thread->state == Sleeping);
    540540
    541         irq_spinlock_unlock(&thread->lock, true);
     541        irq_spinlock_unlock(&thread->lock, irq_dis);
    542542
    543543        if (sleeping)
    544544                waitq_interrupt_sleep(thread);
    545 }
    546 
    547 /** Returns true if the thread was interrupted.
    548  *
    549  * @param thread A valid thread object. User must guarantee it will
    550  *               be alive during the entire call.
    551  * @return true if the thread was already interrupted via thread_interrupt().
    552  */
    553 bool thread_interrupted(thread_t *thread)
    554 {
    555         assert(thread != NULL);
    556 
    557         bool interrupted;
    558 
    559         irq_spinlock_lock(&thread->lock, true);
    560         interrupted = thread->interrupted;
    561         irq_spinlock_unlock(&thread->lock, true);
    562 
    563         return interrupted;
    564545}
    565546
Note: See TracChangeset for help on using the changeset viewer.