Changeset e1b6742 in mainline for kernel/generic/src/proc
- Timestamp:
- 2010-04-18T12:17:11Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e535eeb
- Parents:
- bbda5ab
- Location:
- kernel/generic/src/proc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/task.c
rbbda5ab re1b6742 312 312 * @param id Task ID. 313 313 * 314 * @return Task structure address or NULL if there is no such task 315 * ID. 314 * @return Task structure address or NULL if there is no such task ID. 316 315 * 317 316 */ 318 317 task_t *task_find_by_id(task_id_t id) 319 318 { 320 avltree_node_t *node ;321 node =avltree_search(&tasks_tree, (avltree_key_t) id);319 avltree_node_t *node = 320 avltree_search(&tasks_tree, (avltree_key_t) id); 322 321 323 322 if (node) -
kernel/generic/src/proc/thread.c
rbbda5ab re1b6742 84 84 "Exiting", 85 85 "Lingering" 86 }; 86 }; 87 88 typedef struct { 89 thread_id_t thread_id; 90 thread_t *thread; 91 } thread_iterator_t; 87 92 88 93 /** Lock protecting the threads_tree AVL tree. … … 726 731 THREAD->last_cycle = time; 727 732 } 733 734 static bool thread_search_walker(avltree_node_t *node, void *arg) 735 { 736 thread_t *thread = 737 (thread_t *) avltree_get_instance(node, thread_t, threads_tree_node); 738 thread_iterator_t *iterator = (thread_iterator_t *) arg; 739 740 if (thread->tid == iterator->thread_id) { 741 iterator->thread = thread; 742 return false; 743 } 744 745 return true; 746 } 747 748 /** Find thread structure corresponding to thread ID. 749 * 750 * The threads_lock must be already held by the caller of this function and 751 * interrupts must be disabled. 752 * 753 * @param id Thread ID. 754 * 755 * @return Thread structure address or NULL if there is no such thread ID. 756 * 757 */ 758 thread_t *thread_find_by_id(thread_id_t thread_id) 759 { 760 thread_iterator_t iterator; 761 762 iterator.thread_id = thread_id; 763 iterator.thread = NULL; 764 765 avltree_walk(&threads_tree, thread_search_walker, (void *) &iterator); 766 767 return iterator.thread; 768 } 769 728 770 729 771 /** Process syscall to create new thread.
Note:
See TracChangeset
for help on using the changeset viewer.