fix comment
[AROS.git] / rom / exec / getparenttaskstorageslot.c
blob3a799b30b7954edb154a5bdc17b6164577bd07e5
1 /*
2 Copyright © 2014-2015, 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 Task *ThisTask = GET_THIS_TASK;
52 struct ETask *et = GetETask(ThisTask);
53 IPTR result = (IPTR)NULL;
55 if (!et)
56 return (IPTR)NULL;
58 Forbid(); /* Accessing other task's et_TaskStorage */
60 if (et->et_Parent)
61 result = TaskGetStorageSlot(et->et_Parent, id);
63 Permit();
65 return result;
67 AROS_LIBFUNC_EXIT