2 Copyright © 2015, The AROS Development Team. All rights reserved.
8 #include <aros/debug.h>
9 #include <exec/types.h>
10 #include <aros/libcall.h>
11 #include <proto/utility.h>
12 #include <resources/task.h>
14 #include <resources/task.h>
16 #include "taskres_intern.h"
18 /*****************************************************************************
21 #include <proto/task.h>
23 AROS_LH1(struct TaskList
*, LockTaskList
,
26 AROS_LHA(ULONG
, flags
, D1
),
29 struct TaskResBase
*, TaskResBase
, 1, Task
)
37 Handle to the task list. This is not a direct pointer
38 to the first list element but to a pseudo element instead.
47 UnLockTaskList(), NextTaskEntry()
51 *****************************************************************************/
55 struct TaskListPrivate
*taskList
= NULL
;
57 D(bug("[TaskRes] LockTaskList: flags = $%lx\n", flags
));
59 if (flags
& LTF_WRITE
)
60 ObtainSemaphore(&TaskResBase
->trb_Sem
);
62 ObtainSemaphoreShared(&TaskResBase
->trb_Sem
);
64 if ((taskList
= AllocMem(sizeof(struct TaskListPrivate
), MEMF_CLEAR
)) != NULL
)
66 D(bug("[TaskRes] LockTaskList: TaskList @ 0x%p\n", taskList
));
67 taskList
->tlp_Node
.ln_Name
= (char *)FindTask(NULL
);
68 taskList
->tlp_Flags
= flags
;
69 taskList
->tlp_Tasks
= &TaskResBase
->trb_TaskList
;
70 taskList
->tlp_Next
= (struct TaskListEntry
*)GetHead(taskList
->tlp_Tasks
);
71 AddTail(&TaskResBase
->trb_LockedLists
, &taskList
->tlp_Node
);
74 return (struct TaskList
*)taskList
;