SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
BI_UpdateBuffs.c
Go to the documentation of this file.
1#include "Bdef.h"
2
4{
6 BLACBUFF *bp, *bp2;
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;
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 */
Int BI_BuffIsFree(BLACBUFF *bp, Int Wait)
BLACBUFF * BI_ReadyB
BLACBUFF * BI_ActiveQ
void BI_UpdateBuffs(BLACBUFF *Newbp)
#define Int
Definition Bconfig.h:22
Int Len
Definition Bdef.h:57
BLACBUFF * prev
Definition Bdef.h:62
BLACBUFF * next
Definition Bdef.h:62