exec.library: implement GetParentTaskStorageSlot()
[AROS.git] / rom / exec / getparenttaskstorageslot.c
blob6230da210a664080d2d0ee9438e381f2516aefda
1 /*
2 Copyright © 2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
8 #include "taskstorage.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/exec.h>
15 AROS_LH1(IPTR, GetParentTaskStorageSlot,
17 /* LOCATION */
18 AROS_LHA(LONG, id, D0),
19 struct ExecBase *, SysBase, 186, Exec)
21 /* FUNCTION
22 Get a value for a task storage slot of parent task.
24 INPUTS
25 id - slot ID returned from AllocTaskStorageSlot().
27 RESULT
28 Value stored by SetTaskStorageSlot() on parent task, or
29 (IPTR)NULL if the slot was never used.
31 NOTES
32 Since you are accessing value of another task, the value
33 might be invalid/freed by the time this function returns.
34 To be sure value is still valid, call this function under
35 Forbid().
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 AllocTaskStorageSlot(), FreeTaskStorageSlot(), SetTaskStorageSlot(),
43 GetTaskStorageSlot()
45 INTERNALS
47 ******************************************************************************/
49 AROS_LIBFUNC_INIT
51 struct ETask *et = GetETask(FindTask(NULL));
52 IPTR result = (IPTR)NULL;
54 if (!et)
55 return (IPTR)NULL;
57 Forbid(); /* Accessing other task's et_TaskStorage */
59 result = TaskGetStorageSlot(et->et_Parent, id);
61 Permit();
63 return result;
65 AROS_LIBFUNC_EXIT