Changes in lemon/cplex.cc [1349:f8ec64f78b5f:1336:0759d974de81] in lemon
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/cplex.cc
r1349 r1336 38 38 } 39 39 40 void CplexEnv::incCnt() 41 { 42 _cnt_lock->lock(); 40 CplexEnv::CplexEnv() { 41 int status; 42 _cnt = new int; 43 (*_cnt) = 1; 44 _env = CPXopenCPLEX(&status); 45 if (_env == 0) { 46 delete _cnt; 47 _cnt = 0; 48 throw LicenseError(status); 49 } 50 } 51 52 CplexEnv::CplexEnv(const CplexEnv& other) { 53 _env = other._env; 54 _cnt = other._cnt; 43 55 ++(*_cnt); 44 _cnt_lock->unlock(); 45 } 46 47 void CplexEnv::decCnt() 48 { 49 _cnt_lock->lock(); 56 } 57 58 CplexEnv& CplexEnv::operator=(const CplexEnv& other) { 59 _env = other._env; 60 _cnt = other._cnt; 61 ++(*_cnt); 62 return *this; 63 } 64 65 CplexEnv::~CplexEnv() { 50 66 --(*_cnt); 51 67 if (*_cnt == 0) { 52 68 delete _cnt; 53 _cnt_lock->unlock();54 delete _cnt_lock;55 69 CPXcloseCPLEX(&_env); 56 70 } 57 else _cnt_lock->unlock();58 }59 60 CplexEnv::CplexEnv() {61 int status;62 _env = CPXopenCPLEX(&status);63 if (_env == 0)64 throw LicenseError(status);65 _cnt = new int;66 (*_cnt) = 1;67 _cnt_lock = new bits::Lock;68 }69 70 CplexEnv::CplexEnv(const CplexEnv& other) {71 _env = other._env;72 _cnt = other._cnt;73 _cnt_lock = other._cnt_lock;74 incCnt();75 }76 77 CplexEnv& CplexEnv::operator=(const CplexEnv& other) {78 decCnt();79 _env = other._env;80 _cnt = other._cnt;81 _cnt_lock = other._cnt_lock;82 incCnt();83 return *this;84 }85 86 CplexEnv::~CplexEnv() {87 decCnt();88 71 } 89 72
Note: See TracChangeset
for help on using the changeset viewer.