1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 * University Research and Technology
5 * Corporation. All rights reserved.
6 * Copyright (c) 2004-2005 The University of Tennessee and The University
7 * of Tennessee Research Foundation. All rights
8 * reserved.
9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 * University of Stuttgart. All rights reserved.
11 * Copyright (c) 2004-2005 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights
14 * reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 */
21
22 #include "opal_config.h"
23 #include "opal/class/opal_fifo.h"
24
25 static void opal_fifo_construct (opal_fifo_t *fifo)
26 {
27 OBJ_CONSTRUCT(&fifo->opal_fifo_ghost, opal_list_item_t);
28
29 fifo->opal_fifo_ghost.opal_list_next = &fifo->opal_fifo_ghost;
30
31 /** used to protect against ABA problems when not using a 128-bit compare-and-set */
32 fifo->opal_fifo_ghost.item_free = 0;
33
34 fifo->opal_fifo_head.data.counter = 0;
35 fifo->opal_fifo_head.data.item = (intptr_t) &fifo->opal_fifo_ghost;
36
37 fifo->opal_fifo_tail.data.counter = 0;
38 fifo->opal_fifo_tail.data.item = (intptr_t) &fifo->opal_fifo_ghost;
39 }
40
41 OBJ_CLASS_INSTANCE(opal_fifo_t, opal_object_t, opal_fifo_construct, NULL);