| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 #include "boost/version.hpp"
4
5 #if BOOST_VERSION < 105000
6 #include "boost/thread/xtime.hpp"
7 #endif
8 #include "boost/thread/thread.hpp"
9
10 namespace Gaudi {
11
14 void Sleep(int sec){
15 #if BOOST_VERSION >= 105000
16 boost::this_thread::sleep_for(boost::chrono::seconds(sec));
17 #else
18 using namespace boost;
19 xtime t;
20 if ( xtime_get(&t,TIME_UTC) == TIME_UTC ) {
21 t.sec += sec;
22 thread::sleep(t);
23 }
24 // TODO: (MCl) do something if cannot get the time.
25 #endif
26 }
27
30 void NanoSleep(long long nsec){
31 #if BOOST_VERSION >= 105000
32 boost::this_thread::sleep_for(boost::chrono::nanoseconds(nsec));
33 #else
34 using namespace boost;
35 xtime t;
36 if ( xtime_get(&t,TIME_UTC) == TIME_UTC ) {
37 t.sec += nsec / 1000000000;
38 t.nsec += nsec % 1000000000;
39 thread::sleep(t);
40 }
41 // TODO: (MCl) do something if cannot get the time.
42 #endif
43 }
44
45 }