The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mutexGlpkSolver.inc
Go to the documentation of this file.
1 /**
2  * @file mutexGlpkSolver
3  * file name: mutexGlpkSolver.inc
4  * @author Betti Oesterholz
5  * @date 26.09.2012
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This file provides definitions for the glpk mutex handling.
11  *
12  * Copyright (C) @c GPL3 2010 Betti Oesterholz
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License (GPL) as
16  * published by the Free Software Foundation, either version 3 of the
17  * License, or any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26  *
27  *
28  * This file provides definitions for the glpk mutex handling.
29  * It is needed because with the FEATURE_GLPK_USE_MUTEX_LINAR_PROBLEM_SOLVING
30  * feature the glp library (extern package) linear solver will be used with
31  * a mutex switch, so it can run in treads.
32  * If the glp libary is tread save and FEATURE_GLPK_USE_MUTEX_LINAR_PROBLEM_SOLVING
33  * deactivated this file is obsolete.
34  *
35  */
36 /*
37 History:
38 26.09.2012 Oesterholz created
39 */
40 
41 #ifdef FEATURE_GLPK_USE_MUTEX_LINAR_PROBLEM_SOLVING
42  //just define mutex once
43  #ifndef DEFINE_GLPK_USE_MUTEX_LINAR_PROBLEM_SOLVING
44 
45  #define DEFINE_GLPK_USE_MUTEX_LINAR_PROBLEM_SOLVING
46 
47  #include <pthread.h>
48 
49  #ifdef WINDOWS
50  static HANDLE mutexGlpkSolver = CreateMutex(
51  NULL, // default security attributes
52  FALSE, // initially not owned
53  NULL); // unnamed mutex
54 
55  //TODO? for close handle CloseHandle( mutexGlpkSolver );
56 
57  #else //WINDOWS
58  static pthread_mutex_t mutexGlpkSolver = PTHREAD_MUTEX_INITIALIZER;
59  #endif //WINDOWS
60 
61  #endif// DEFINE_GLPK_USE_MUTEX_LINAR_PROBLEM_SOLVING
62 
63 #endif //FEATURE_GLPK_USE_MUTEX_LINAR_PROBLEM_SOLVING