StarPU Handbook
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
include
starpu_task_list.h
Go to the documentation of this file.
1
/* StarPU --- Runtime system for heterogeneous multicore architectures.
2
*
3
* Copyright (C) 2010-2012 Université de Bordeaux
4
*
5
* StarPU is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU Lesser General Public License as published by
7
* the Free Software Foundation; either version 2.1 of the License, or (at
8
* your option) any later version.
9
*
10
* StarPU is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*
14
* See the GNU Lesser General Public License in COPYING.LGPL for more details.
15
*/
16
17
#ifndef __STARPU_TASK_LIST_H__
18
#define __STARPU_TASK_LIST_H__
19
20
#include <
starpu_task.h
>
21
#include <
starpu_util.h
>
22
23
#ifdef __cplusplus
24
extern
"C"
25
{
26
#endif
27
28
struct
starpu_task_list
29
{
30
struct
starpu_task
*
head
;
31
struct
starpu_task
*
tail
;
32
};
33
34
static
STARPU_INLINE
35
void
starpu_task_list_init
(
struct
starpu_task_list
*list)
36
{
37
list->
head
= NULL;
38
list->
tail
= NULL;
39
}
40
41
static
STARPU_INLINE
42
void
starpu_task_list_push_front
(
struct
starpu_task_list
*list,
43
struct
starpu_task
*task)
44
{
45
if
(list->
tail
== NULL)
46
{
47
list->
tail
= task;
48
}
49
else
50
{
51
list->
head
->
prev
= task;
52
}
53
54
task->
prev
= NULL;
55
task->
next
= list->
head
;
56
list->
head
= task;
57
}
58
59
static
STARPU_INLINE
60
void
starpu_task_list_push_back
(
struct
starpu_task_list
*list,
61
struct
starpu_task
*task)
62
{
63
if
(list->
head
== NULL)
64
{
65
list->
head
= task;
66
}
67
else
68
{
69
list->
tail
->
next
= task;
70
}
71
72
task->
next
= NULL;
73
task->
prev
= list->
tail
;
74
list->
tail
= task;
75
}
76
77
static
STARPU_INLINE
78
struct
starpu_task
*
starpu_task_list_front
(
struct
starpu_task_list
*list)
79
{
80
return
list->
head
;
81
}
82
83
static
STARPU_INLINE
84
struct
starpu_task
*
starpu_task_list_back
(
struct
starpu_task_list
*list)
85
{
86
return
list->
tail
;
87
}
88
89
static
STARPU_INLINE
90
int
starpu_task_list_empty
(
struct
starpu_task_list
*list)
91
{
92
return
(list->
head
== NULL);
93
}
94
95
static
STARPU_INLINE
96
void
starpu_task_list_erase
(
struct
starpu_task_list
*list,
97
struct
starpu_task
*task)
98
{
99
struct
starpu_task
*p = task->
prev
;
100
101
if
(p)
102
{
103
p->
next
= task->
next
;
104
}
105
else
106
{
107
list->
head
= task->
next
;
108
}
109
110
if
(task->
next
)
111
{
112
task->
next
->
prev
= p;
113
}
114
else
115
{
116
list->
tail
= p;
117
}
118
119
task->
prev
= NULL;
120
task->
next
= NULL;
121
}
122
123
static
STARPU_INLINE
124
struct
starpu_task
*
starpu_task_list_pop_front
(
struct
starpu_task_list
*list)
125
{
126
struct
starpu_task
*task = list->
head
;
127
128
if
(task)
129
starpu_task_list_erase
(list, task);
130
131
return
task;
132
}
133
134
static
STARPU_INLINE
135
struct
starpu_task
*
starpu_task_list_pop_back
(
struct
starpu_task_list
*list)
136
{
137
struct
starpu_task
*task = list->
tail
;
138
139
if
(task)
140
starpu_task_list_erase
(list, task);
141
142
return
task;
143
}
144
145
static
STARPU_INLINE
146
struct
starpu_task
*
starpu_task_list_begin
(
struct
starpu_task_list
*list)
147
{
148
return
list->
head
;
149
}
150
151
static
STARPU_INLINE
152
struct
starpu_task
*starpu_task_list_end(
struct
starpu_task_list
*list
STARPU_ATTRIBUTE_UNUSED
)
153
{
154
return
NULL;
155
}
156
157
static
STARPU_INLINE
158
struct
starpu_task
*
starpu_task_list_next
(
struct
starpu_task
*task)
159
{
160
return
task->
next
;
161
}
162
163
#ifdef __cplusplus
164
}
165
#endif
166
167
#endif
/* __STARPU_TASK_LIST_H__ */
Generated on Mon Mar 9 2015 18:32:05 for StarPU Handbook by
1.8.1.2