ScaLAPACK 2.1
2.1
ScaLAPACK: Scalable Linear Algebra PACKage
BI_UpdateBuffs.c
Go to the documentation of this file.
1
#include "
Bdef.h
"
2
3
void
BI_UpdateBuffs
(
BLACBUFF
*Newbp)
4
{
5
int
BI_BuffIsFree
(
BLACBUFF
*,
int
);
6
BLACBUFF
*bp, *bp2;
7
extern
BLACBUFF
*
BI_ReadyB
, *
BI_ActiveQ
;
8
9
if
(Newbp)
10
{
11
if
(
BI_ActiveQ
== NULL)
BI_ActiveQ
= Newbp->
prev
= Newbp;
12
else
13
{
14
BI_ActiveQ
->
prev
->
next
= Newbp;
15
Newbp->
prev
=
BI_ActiveQ
->
prev
;
16
BI_ActiveQ
->
prev
= Newbp;
17
}
18
Newbp->
next
= NULL;
19
if
(Newbp ==
BI_ReadyB
)
BI_ReadyB
= NULL;
20
}
21
/*
22
* See if any active buffers are ready for reuse.
23
*/
24
for
(bp=
BI_ActiveQ
; bp != NULL; bp = bp2)
25
{
26
bp2 = bp->
next
;
27
if
(
BI_BuffIsFree
(bp, 0) )
/* if all of buff's Aops are done */
28
{
29
/*
30
* Remove bp from BI_ActiveQ -- update pointers
31
*/
32
if
(bp->
next
) bp->
next
->
prev
= bp->
prev
;
33
else
BI_ActiveQ
->
prev
= bp->
prev
;
34
if
(bp !=
BI_ActiveQ
) bp->
prev
->
next
= bp->
next
;
35
else
BI_ActiveQ
=
BI_ActiveQ
->
next
;
36
37
/*
38
* If no ready buffer, inactive buff becomes ready
39
*/
40
if
(
BI_ReadyB
== NULL)
BI_ReadyB
= bp;
41
/*
42
* If inactive buff bigger than present ready buff, release ready,
43
* and inactive buff becomes ready
44
*/
45
else
if
(
BI_ReadyB
->
Len
< bp->
Len
)
46
{
47
free(
BI_ReadyB
);
48
BI_ReadyB
= bp;
49
}
50
/*
51
* If ready buffer exists and is bigger than inactive buff,
52
* free inactive buff
53
*/
54
else
free(bp);
55
}
56
}
57
}
/* end BI_UpdateBuffs */
bLaCbUfF::next
BLACBUFF * next
Definition:
Bdef.h:62
bLaCbUfF::Len
int Len
Definition:
Bdef.h:57
bLaCbUfF
Definition:
Bdef.h:54
BI_ActiveQ
BLACBUFF * BI_ActiveQ
Definition:
BI_GlobalVars.c:9
BI_ReadyB
BLACBUFF * BI_ReadyB
Definition:
BI_GlobalVars.c:8
bLaCbUfF::prev
BLACBUFF * prev
Definition:
Bdef.h:62
Bdef.h
BI_UpdateBuffs
void BI_UpdateBuffs(BLACBUFF *Newbp)
Definition:
BI_UpdateBuffs.c:3
BI_BuffIsFree
int BI_BuffIsFree(BLACBUFF *bp, int Wait)
Definition:
BI_BuffIsFree.c:3
BLACS
SRC
BI_UpdateBuffs.c
Generated by
1.8.16