Changeset 1871118 in mainline for kernel/generic/include/proc/thread.h
- Timestamp:
- 2023-02-10T22:59:11Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 11d2c983
- Parents:
- daadfa6
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-10 22:53:12)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-10 22:59:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/proc/thread.h
rdaadfa6 r1871118 70 70 /** Thread structure. There is one per thread. */ 71 71 typedef struct thread { 72 atomic_refcount_t refcount; 73 72 74 link_t rq_link; /**< Run queue link. */ 73 75 link_t wq_link; /**< Wait queue link. */ … … 77 79 odlink_t lthreads; 78 80 81 /** 82 * If true, the thread is terminating. 83 * It will not go to sleep in interruptible synchronization functions 84 * and will call thread_exit() before returning to userspace. 85 */ 86 volatile bool interrupted; 87 88 /** Waitq for thread_join_timeout(). */ 89 waitq_t join_wq; 90 79 91 /** Lock protecting thread structure. 80 92 * 81 * Protects the whole thread structure except list linksabove.93 * Protects the whole thread structure except fields listed above. 82 94 */ 83 95 IRQ_SPINLOCK_DECLARE(lock); … … 133 145 */ 134 146 bool in_copy_to_uspace; 135 136 /**137 * If true, the thread will not go to sleep at all and will call138 * thread_exit() before returning to userspace.139 */140 bool interrupted;141 142 /** If true, thread_join_timeout() cannot be used on this thread. */143 bool detached;144 /** Waitq for thread_join_timeout(). */145 waitq_t join_wq;146 /** Link used in the joiner_head list. */147 link_t joiner_link;148 147 149 148 #ifdef CONFIG_FPU … … 219 218 extern void thread_interrupt(thread_t *, bool); 220 219 220 static inline thread_t *thread_ref(thread_t *thread) 221 { 222 refcount_up(&thread->refcount); 223 return thread; 224 } 225 226 static inline thread_t *thread_try_ref(thread_t *thread) 227 { 228 if (refcount_try_up(&thread->refcount)) 229 return thread; 230 else 231 return NULL; 232 } 233 234 extern void thread_put(thread_t *); 235 221 236 #ifndef thread_create_arch 222 237 extern errno_t thread_create_arch(thread_t *, thread_flags_t); … … 236 251 extern errno_t thread_join(thread_t *); 237 252 extern errno_t thread_join_timeout(thread_t *, uint32_t, unsigned int); 238 extern void thread_detach(thread_t *);239 253 240 254 extern void thread_print_list(bool); 241 extern void thread_destroy(thread_t *, bool);242 255 extern thread_t *thread_find_by_id(thread_id_t); 243 256 extern size_t thread_count(void); … … 245 258 extern thread_t *thread_next(thread_t *); 246 259 extern void thread_update_accounting(bool); 247 extern bool thread_exists(thread_t *);260 extern thread_t *thread_try_get(thread_t *); 248 261 249 262 extern void thread_migration_disable(void);
Note:
See TracChangeset
for help on using the changeset viewer.