Changeset 278b4a30 in mainline
- Timestamp:
- 2010-05-02T10:41:23Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7ed8530
- Parents:
- 0c42638
- Location:
- kernel/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/proc/task.h
r0c42638 r278b4a30 133 133 extern task_t *task_create(as_t *, const char *); 134 134 extern void task_destroy(task_t *); 135 extern void task_hold(task_t *); 136 extern void task_release(task_t *); 135 137 extern task_t *task_find_by_id(task_id_t); 136 138 extern int task_kill(task_id_t); -
kernel/generic/src/proc/task.c
r0c42638 r278b4a30 1 1 /* 2 * Copyright (c) 20 01-2004Jakub Jermar2 * Copyright (c) 2010 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 257 257 } 258 258 259 /** Hold a reference to a task. 260 * 261 * Holding a reference to a task prevents destruction of that task. 262 * 263 * @param t Task to be held. 264 */ 265 void task_hold(task_t *t) 266 { 267 atomic_inc(&t->refcount); 268 } 269 270 /** Release a reference to a task. 271 * 272 * The last one to release a reference to a task destroys the task. 273 * 274 * @param t Task to be released. 275 */ 276 void task_release(task_t *t) 277 { 278 if ((atomic_predec(&t->refcount)) == 0) 279 task_destroy(t); 280 } 281 259 282 /** Syscall for reading task ID from userspace. 260 283 *
Note:
See TracChangeset
for help on using the changeset viewer.