Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:47:26

0001 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
0002 /*
0003  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
0004  *                         University Research and Technology
0005  *                         Corporation.  All rights reserved.
0006  * Copyright (c) 2004-2016 The University of Tennessee and The University
0007  *                         of Tennessee Research Foundation.  All rights
0008  *                         reserved.
0009  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
0010  *                         University of Stuttgart.  All rights reserved.
0011  * Copyright (c) 2004-2005 The Regents of the University of California.
0012  *                         All rights reserved.
0013  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
0014  * Copyright (c) 2007-2016 Los Alamos National Security, LLC.  All rights
0015  *                         reserved.
0016  * Copyright (c) 2007      Voltaire. All rights reserved.
0017  * Copyright (c) 2010      Oracle and/or its affiliates.  All rights reserved.
0018  *
0019  * Copyright (c) 2017      Intel, Inc. All rights reserved.
0020  * Copyright (c) 2021-2022 Nanook Consulting  All rights reserved.
0021  * $COPYRIGHT$
0022  *
0023  * Additional copyrights may follow
0024  *
0025  * $HEADER$
0026  */
0027 
0028 #ifndef PMIX_MUTEX_H
0029 #define PMIX_MUTEX_H 1
0030 
0031 #include "src/include/pmix_config.h"
0032 
0033 BEGIN_C_DECLS
0034 
0035 /**
0036  * @file:
0037  *
0038  * Mutual exclusion functions.
0039  *
0040  * Functions for locking of critical sections.
0041  */
0042 
0043 /**
0044  * Opaque mutex object
0045  */
0046 typedef struct pmix_mutex_t pmix_mutex_t;
0047 typedef struct pmix_mutex_t pmix_recursive_mutex_t;
0048 
0049 /**
0050  * Try to acquire a mutex.
0051  *
0052  * @param mutex         Address of the mutex.
0053  * @return              0 if the mutex was acquired, 1 otherwise.
0054  */
0055 static inline int pmix_mutex_trylock(pmix_mutex_t *mutex);
0056 
0057 /**
0058  * Acquire a mutex.
0059  *
0060  * @param mutex         Address of the mutex.
0061  */
0062 static inline void pmix_mutex_lock(pmix_mutex_t *mutex);
0063 
0064 /**
0065  * Release a mutex.
0066  *
0067  * @param mutex         Address of the mutex.
0068  */
0069 static inline void pmix_mutex_unlock(pmix_mutex_t *mutex);
0070 
0071 /**
0072  * Try to acquire a mutex using atomic operations.
0073  *
0074  * @param mutex         Address of the mutex.
0075  * @return              0 if the mutex was acquired, 1 otherwise.
0076  */
0077 static inline int pmix_mutex_atomic_trylock(pmix_mutex_t *mutex);
0078 
0079 /**
0080  * Acquire a mutex using atomic operations.
0081  *
0082  * @param mutex         Address of the mutex.
0083  */
0084 static inline void pmix_mutex_atomic_lock(pmix_mutex_t *mutex);
0085 
0086 /**
0087  * Release a mutex using atomic operations.
0088  *
0089  * @param mutex         Address of the mutex.
0090  */
0091 static inline void pmix_mutex_atomic_unlock(pmix_mutex_t *mutex);
0092 
0093 END_C_DECLS
0094 
0095 #include "pmix_mutex_unix.h"
0096 
0097 #endif /* PMIX_MUTEX_H */