COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/windows.cc

    r1053 r1131  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    9999      GetSystemTime(&time);
    100100      char buf1[11], buf2[9], buf3[5];
    101           if (GetDateFormat(MY_LOCALE, 0, &time,
     101          if (GetDateFormat(MY_LOCALE, 0, &time,
    102102                        ("ddd MMM dd"), buf1, 11) &&
    103103          GetTimeFormat(MY_LOCALE, 0, &time,
     
    131131#endif
    132132    }
     133
     134    WinLock::WinLock() {
     135#ifdef WIN32
     136      CRITICAL_SECTION *lock = new CRITICAL_SECTION;
     137      InitializeCriticalSection(lock);
     138      _repr = lock;
     139#endif
     140    }
     141   
     142    WinLock::~WinLock() {
     143#ifdef WIN32
     144      CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
     145      DeleteCriticalSection(lock);
     146      delete lock;
     147#endif
     148    }
     149
     150    void WinLock::lock() {
     151#ifdef WIN32
     152      CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
     153      EnterCriticalSection(lock);
     154#endif
     155    }
     156
     157    void WinLock::unlock() {
     158#ifdef WIN32
     159      CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
     160      LeaveCriticalSection(lock);
     161#endif
     162    }
    133163  }
    134164}
Note: See TracChangeset for help on using the changeset viewer.