Changeset 814c4f5 in mainline
- Timestamp:
- 2008-08-24T10:47:19Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 90a428a
- Parents:
- 1c87d79
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/task.c
r1c87d79 r814c4f5 72 72 static task_id_t task_counter = 0; 73 73 74 /** Initialize tasks 75 * 76 * Initialize kernel tasks support. 77 * 78 */ 74 /** Initialize kernel tasks support. */ 79 75 void task_init(void) 80 76 { … … 84 80 85 81 /* 86 * The idea behind this walker is to remember a single task different from TASK. 82 * The idea behind this walker is to remember a single task different from 83 * TASK. 87 84 */ 88 85 static bool task_done_walker(avltree_node_t *node, void *arg) … … 99 96 } 100 97 101 /** Kill all tasks except the current task. 102 * 103 */ 98 /** Kill all tasks except the current task. */ 104 99 void task_done(void) 105 100 { … … 133 128 } 134 129 135 /** Create new task 136 * 137 * Create new task with no threads. 138 * 139 * @param as Task's address space. 140 * @param name Symbolic name. 141 * 142 * @return New task's structure 130 /** Create new task with no threads. 131 * 132 * @param as Task's address space. 133 * @param name Symbolic name. 134 * 135 * @return New task's structure. 143 136 * 144 137 */ … … 195 188 /** Destroy task. 196 189 * 197 * @param t 190 * @param t Task to be destroyed. 198 191 */ 199 192 void task_destroy(task_t *t) … … 228 221 /** Syscall for reading task ID from userspace. 229 222 * 230 * @param uspace_task_id Userspace address of 8-byte buffer where to store231 * current task ID.232 * 233 * @return 0on success or an error code from @ref errno.h.223 * @param uspace_task_id userspace address of 8-byte buffer 224 * where to store current task ID. 225 * 226 * @return Zero on success or an error code from @ref errno.h. 234 227 */ 235 228 unative_t sys_task_get_id(task_id_t *uspace_task_id) 236 229 { 237 230 /* 238 * No need to acquire lock on TASK because taskid 239 * remains constant forthe lifespan of the task.231 * No need to acquire lock on TASK because taskid remains constant for 232 * the lifespan of the task. 240 233 */ 241 234 return (unative_t) copy_to_uspace(uspace_task_id, &TASK->taskid, … … 245 238 /** Find task structure corresponding to task ID. 246 239 * 247 * The tasks_lock must be already held by the caller of this function 248 * and interrupts must be disabled. 249 * 250 * @param id Task ID. 251 * 252 * @return Task structure address or NULL if there is no such task ID. 253 */ 254 task_t *task_find_by_id(task_id_t id) 255 { 256 avltree_node_t *node; 240 * The tasks_lock must be already held by the caller of this function and 241 * interrupts must be disabled. 242 * 243 * @param id Task ID. 244 * 245 * @return Task structure address or NULL if there is no such task 246 * ID. 247 */ 248 task_t *task_find_by_id(task_id_t id) { avltree_node_t *node; 257 249 258 250 node = avltree_search(&tasks_tree, (avltree_key_t) id); … … 265 257 /** Get accounting data of given task. 266 258 * 267 * Note that task lock of 't' must be already held and 268 * interrupts must be already disabled. 269 * 270 * @param t Pointer to thread. 271 * 259 * Note that task lock of 't' must be already held and interrupts must be 260 * already disabled. 261 * 262 * @param t Pointer to thread. 263 * 264 * @return Number of cycles used by the task and all its threads 265 * so far. 272 266 */ 273 267 uint64_t task_get_accounting(task_t *t) … … 301 295 * It signals all the task's threads to bail it out. 302 296 * 303 * @param id 304 * 305 * @return 0 on success or an error code from errno.h297 * @param id ID of the task to be killed. 298 * 299 * @return Zero on success or an error code from errno.h. 306 300 */ 307 301 int task_kill(task_id_t id) … … 324 318 325 319 /* 326 * Interrupt all threads except ktaskclnp.320 * Interrupt all threads. 327 321 */ 328 322 spinlock_lock(&ta->lock);
Note:
See TracChangeset
for help on using the changeset viewer.