void pushBottom(Data* p) { int localBot; localBot = _bottom; _deq[localBot] = p; localBot++; _bottom = localBot; }

Data* popBottom() { Age oldAge, newAge; int localBot; localBot = _bottom; if (localBot == 0) return NULL; localBot--; _bottom = localBot; // (1) _bottom を書く p = _deq[localBot]; // (2) データを読む oldAge = _age; // (3) _age を読む if (localBot > oldAge.top) return p; _bottom = 0; newAge.top = 0; newAge.tag = oldAge.tag + 1; if (localBot == oldAge.top) { Compare-And-Swap(_age, oldAge, newAge); if (書き換え成功) return p; } _age = newAge; return NULL; }