Changeset 78acbc72 in mainline
- Timestamp:
- 2023-02-07T18:43:26Z (22 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ba25c4b
- Parents:
- 0366d09d
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/proc/thread.h
r0366d09d r78acbc72 221 221 extern void thread_ready(thread_t *); 222 222 extern void thread_exit(void) __attribute__((noreturn)); 223 extern void thread_interrupt(thread_t *); 224 extern bool thread_interrupted(thread_t *); 223 extern void thread_interrupt(thread_t *, bool); 225 224 226 225 #ifndef thread_create_arch -
kernel/generic/src/proc/task.c
r0366d09d r78acbc72 536 536 537 537 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); 550 539 } 551 540 -
kernel/generic/src/proc/thread.c
r0366d09d r78acbc72 530 530 * will remain valid until thread_interrupt() exits. 531 531 */ 532 void thread_interrupt(thread_t *thread )532 void thread_interrupt(thread_t *thread, bool irq_dis) 533 533 { 534 534 assert(thread != NULL); 535 535 536 irq_spinlock_lock(&thread->lock, true);536 irq_spinlock_lock(&thread->lock, irq_dis); 537 537 538 538 thread->interrupted = true; 539 539 bool sleeping = (thread->state == Sleeping); 540 540 541 irq_spinlock_unlock(&thread->lock, true);541 irq_spinlock_unlock(&thread->lock, irq_dis); 542 542 543 543 if (sleeping) 544 544 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 will550 * 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;564 545 } 565 546
Note:
See TracChangeset
for help on using the changeset viewer.