Blame src/include/mpir_refcount_single.h

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *  (C) 2001 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
#ifndef MPIR_REFCOUNT_SINGLE_H_INCLUDED
Packit Service c5cf8c
#define MPIR_REFCOUNT_SINGLE_H_INCLUDED
Packit Service c5cf8c
Packit Service c5cf8c
/* define a type for the completion counter */
Packit Service c5cf8c
typedef int MPIR_cc_t;
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_cc_get(cc_) (cc_)
Packit Service c5cf8c
#define MPIR_cc_set(cc_ptr_, val_) (*(cc_ptr_)) = (val_)
Packit Service c5cf8c
#define MPIR_cc_is_complete(cc_ptr_) (0 == *(cc_ptr_))
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_cc_incr(cc_ptr_, was_incomplete_)  \
Packit Service c5cf8c
    do {                                        \
Packit Service c5cf8c
        *(was_incomplete_) = (*(cc_ptr_))++;    \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_cc_decr(cc_ptr_, incomplete_)      \
Packit Service c5cf8c
    do {                                        \
Packit Service c5cf8c
        *(incomplete_) = --(*(cc_ptr_));        \
Packit Service c5cf8c
        MPIR_Assert(*(incomplete_) >= 0);       \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
/* "publishes" the obj with handle value (handle_) via the handle pointer
Packit Service c5cf8c
 * (hnd_lval_).  That is, it is a version of the following statement that fixes
Packit Service c5cf8c
 * memory consistency issues:
Packit Service c5cf8c
 *     (hnd_lval_) = (handle_);
Packit Service c5cf8c
 *
Packit Service c5cf8c
 * assumes that the following is always true: typeof(*hnd_lval_ptr_)==int
Packit Service c5cf8c
 */
Packit Service c5cf8c
/* This could potentially be generalized beyond MPI-handle objects, but we
Packit Service c5cf8c
 * should only take that step after seeing good evidence of its use.  A general
Packit Service c5cf8c
 * macro (that is portable to non-gcc compilers) will need type information to
Packit Service c5cf8c
 * make the appropriate volatile cast. */
Packit Service c5cf8c
/* Ideally _GLOBAL would use this too, but we don't want to count on OPA
Packit Service c5cf8c
 * availability in _GLOBAL mode.  Instead the GLOBAL critical section should be
Packit Service c5cf8c
 * used. */
Packit Service c5cf8c
#define MPIR_OBJ_PUBLISH_HANDLE(hnd_lval_, handle_)     \
Packit Service c5cf8c
    do {                                                \
Packit Service c5cf8c
        (hnd_lval_) = (handle_);                        \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#endif /* MPIR_REFCOUNT_SINGLE_H_INCLUDED */