Gaudi Framework, version v23r6

Home   Generated: Wed Jan 30 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Sleep.cpp
Go to the documentation of this file.
1 #include "GaudiKernel/Sleep.h"
2 
3 #if BOOST_VERSION < 15000
4 #include "boost/thread/xtime.hpp"
5 #endif
6 #include "boost/thread/thread.hpp"
7 
8 namespace Gaudi {
9 
12  void Sleep(int sec){
13 #if BOOST_VERSION >= 15000
14  boost::this_thread::sleep_for(boost::chrono::seconds(sec));
15 #else
16  using namespace boost;
17  xtime t;
18  if ( xtime_get(&t,TIME_UTC) == TIME_UTC ) {
19  t.sec += sec;
20  thread::sleep(t);
21  }
22  // TODO: (MCl) do something if cannot get the time.
23 #endif
24  }
25 
28  void NanoSleep(long long nsec){
29 #if BOOST_VERSION >= 15000
30  boost::this_thread::sleep_for(boost::chrono::nanoseconds(nsec));
31 #else
32  using namespace boost;
33  xtime t;
34  if ( xtime_get(&t,TIME_UTC) == TIME_UTC ) {
35  t.sec += nsec / 1000000000;
36  t.nsec += nsec % 1000000000;
37  thread::sleep(t);
38  }
39  // TODO: (MCl) do something if cannot get the time.
40 #endif
41  }
42 
43 }

Generated at Wed Jan 30 2013 17:13:40 for Gaudi Framework, version v23r6 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004