Scippy

SCIP

Solving Constraint Integer Programs

tpi_openmp.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file tpi_openmp.h
17  * @ingroup TASKINTERFACE
18  * @brief the tpi_openmp redefines the lock functionality and some condition functionality as macros
19  * @author Robert Lion Gottwald
20  * @author Stephen J. Maher
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #ifdef TPI_OMP
26 
27 #ifndef _TPI_OPENMP_H_
28 #define _TPI_OPENMP_H_
29 
30 /* define locks and some condition functionality as macros */
31 
32 /* lock */
33 #define SCIPtpiInitLock(lock) (omp_init_lock(lock), SCIP_OKAY)
34 #define SCIPtpiDestroyLock(lock) (omp_destroy_lock(lock))
35 #define SCIPtpiAcquireLock(lock) (omp_set_lock(lock), SCIP_OKAY)
36 #define SCIPtpiReleaseLock(lock) (omp_unset_lock(lock), SCIP_OKAY)
37 
38 /* condition */
39 #define SCIPtpiInitCondition(condition) ( omp_init_lock(&(condition)->_lock), \
40  (condition)->_waiters = 0, (condition)->_waitnum = 0, (condition)->_signals = 0, SCIP_OKAY )
41 #define SCIPtpiDestroyCondition(condition) do { assert((condition)->_waiters == 0); assert((condition)->_waitnum == 0); assert((condition)->_signals == 0); omp_destroy_lock(&(condition)->_lock); } while(0)
42 #endif
43 
44 #endif