Scippy

SCIP

Solving Constraint Integer Programs

tpi_tnycthrd.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-2022 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 visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file tpi_tnycthrd.h
17  * @ingroup TASKINTERFACE
18  * @brief the tinycthreads implementation defines the lock and condition functionality as macros
19  * @author Leona 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_TNYC
26 
27 #ifndef _TPI_TINYCTHRD_H_
28 #define _TPI_TINYCTHRD_H_
29 
30 /* lock */
31 #define SCIPtpiInitLock(lock) ( mtx_init((lock), mtx_plain) == thrd_success ? SCIP_OKAY : SCIP_ERROR )
32 #define SCIPtpiDestroyLock(lock) ( mtx_destroy(lock) )
33 #define SCIPtpiAcquireLock(lock) ( mtx_lock(lock) == thrd_success ? SCIP_OKAY : SCIP_ERROR )
34 #define SCIPtpiReleaseLock(lock) ( mtx_unlock(lock) == thrd_success ? SCIP_OKAY : SCIP_ERROR )
35 
36 /* condition */
37 #define SCIPtpiInitCondition(condition) ( cnd_init(condition) == thrd_success ? SCIP_OKAY : SCIP_ERROR )
38 #define SCIPtpiDestroyCondition(condition) ( cnd_destroy(condition) )
39 #define SCIPtpiSignalCondition(condition) ( cnd_signal(condition) == thrd_success ? SCIP_OKAY : SCIP_ERROR )
40 #define SCIPtpiBroadcastCondition(condition) ( cnd_broadcast(condition) == thrd_success ? SCIP_OKAY : SCIP_ERROR )
41 #define SCIPtpiWaitCondition(condition, lock) ( cnd_wait((condition), (lock)) == thrd_success ? SCIP_OKAY: SCIP_ERROR )
42 
43 
44 extern _Thread_local int _threadnumber;
45 
46 #define SCIPtpiGetThreadNum() /*lint -e40*/ _threadnumber
47 
48 #endif
49 
50 #endif