Velocities and forces for selections.
[gromacs/qmmm-gamess-us.git] / include / thread_mpi / nothreads.h
blobfc0b3259ad5be8a72a064076803900b027278cf6
1 /*
2 This source code file is part of thread_mpi.
3 Written by Sander Pronk, Erik Lindahl, and possibly others.
5 Copyright (c) 2009, Sander Pronk, Erik Lindahl.
6 All rights reserved.
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 1) Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2) Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3) Neither the name of the copyright holders nor the
16 names of its contributors may be used to endorse or promote products
17 derived from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
20 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
23 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 If you want to redistribute modifications, please consider that
31 scientific software is very special. Version control is crucial -
32 bugs must be traceable. We will be happy to consider code for
33 inclusion in the official distribution, but derived work should not
34 be called official thread_mpi. Details are found in the README & COPYING
35 files.
37 /*! \file nothreads.h
39 * @brief dummy-threads specific data structures
44 /*! \brief Status for one-time initialization of thread stuff.
46 * \internal
48 * This is used both for the static initialization, and as
49 * a safeguard to catch errors where the user
50 * is sloppy and fails to initialize various things in the
51 * thread system. It is only defined here to enable static
52 * initialization - don't use it outside the thread code.
54 enum tMPI_Thread_once_status
56 TMPI_THREAD_ONCE_STATUS_NOTCALLED = 0, /*!< Not yet initialized */
57 TMPI_THREAD_ONCE_STATUS_PROGRESS = 1, /*!< Somebody working on it */
58 TMPI_THREAD_ONCE_STATUS_READY = 2 /*!< Everything completed */
59 };
65 /*! \brief win32 implementation of the abstract tMPI_Thread type
67 * The contents of this structure depends on the actual threads
68 * implementation used.
70 typedef void* tMPI_Thread_t;
73 /*! \brief Opaque mutex datatype
75 * This type is only defined in the header to enable static
76 * initialization with TMPI_THREAD_MUTEX_INITIALIZER.
77 * You should _never_ touch the contents or create a variable
78 * with automatic storage class without calling tMPI_Thread_mutex_init().
80 typedef void* tMPI_Thread_mutex_t;
81 /*! \brief Statical initializer for tMPI_Thread_mutex_t
83 * See the description of the tMPI_Thread_mutex_t datatype for instructions
84 * on how to use this. Note that any variables initialized with this value
85 * MUST have static storage allocation.
87 #define TMPI_THREAD_MUTEX_INITIALIZER { TMPI_THREAD_ONCE_STATUS_NOTCALLED }
90 /*! \brief Pthread implementation of the abstract tMPI_Thread_key type
92 * The contents of this structure depends on the actual threads
93 * implementation used. */
94 typedef void* tMPI_Thread_key_t;
97 /*! \brief One-time initialization data for thread
99 * This is an opaque datatype which is necessary for tMPI_Thread_once(),
100 * but since it needs to be initialized statically it must be defined
101 * in the header. You will be sorry if you touch the contents.
102 * Variables of this type should always be initialized statically to
103 * TMPI_THREAD_ONCE_INIT.
105 * This type is used as control data for single-time initialization.
106 * The most common example is a mutex at file scope used when calling
107 * a non-threadsafe function, e.g. the FFTW initialization routines.
110 typedef void* tMPI_Thread_once_t;
111 /*! \brief Statical initializer for tMPI_Thread_once_t
113 * See the description of the tMPI_Thread_once_t datatype for instructions
114 * on how to use this. Normally, all variables of that type should be
115 * initialized statically to this value.
117 #define TMPI_THREAD_ONCE_INIT NULL
120 /*! \brief Condition variable handle for threads
122 * Condition variables are useful for synchronization together
123 * with a mutex: Lock the mutex and check if our thread is the last
124 * to the barrier. If no, wait for the condition to be signaled.
125 * If yes, reset whatever data you want and then signal the condition.
127 * This should be considered an opaque structure, but since it is sometimes
128 * useful to initialize it statically it must go in the header.
129 * You will be sorry if you touch the contents.
131 * There are two alternatives: Either initialize it as a static variable
132 * with TMPI_THREAD_COND_INITIALIZER, or call tMPI_Thread_cond_init()
133 * before using it.
135 typedef void* tMPI_Thread_cond_t;
137 /*typedef pthread_cond_t tMPI_Thread_cond_t;*/
140 /*! \brief Statical initializer for tMPI_Thread_cond_t
142 * See the description of the tMPI_Thread_cond_t datatype for instructions
143 * on how to use this. Note that any variables initialized with this value
144 * MUST have static storage allocation.
146 #define TMPI_THREAD_COND_INITIALIZER NULL
152 /*! \brief Pthread implementation of barrier type.
154 * The contents of this structure depends on the actual threads
155 * implementation used.
157 typedef void* tMPI_Thread_barrier_t;
160 /*! \brief Statical initializer for tMPI_Thread_barrier_t
162 * See the description of the tMPI_Thread_barrier_t datatype for instructions
163 * on how to use this. Note that variables initialized with this value
164 * MUST have static storage allocation.
166 * \param count Threshold for barrier
168 #define TMPI_THREAD_BARRIER_INITIALIZER(count) NULL