Use std::thread with libc++

boost::thread is only used due to libstdc++ 4.8 missing a bunch of
stuff.
This commit is contained in:
Thomas Goyne 2014-05-25 15:06:23 -07:00
parent 6477ef933b
commit 50f2e550e2
1 changed files with 10 additions and 0 deletions

View File

@ -12,7 +12,13 @@
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <cstddef>
#ifdef _LIBCPP_VERSION
#include <thread>
#else
#include <boost/thread.hpp> #include <boost/thread.hpp>
#endif
namespace agi { namespace util { namespace agi { namespace util {
@ -25,7 +31,11 @@ timeval time_log() {
void SetThreadName(const char *) { } void SetThreadName(const char *) { }
void sleep_for(int ms) { void sleep_for(int ms) {
#ifdef __clang__
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
#else
boost::this_thread::sleep_for(boost::chrono::milliseconds(ms)); boost::this_thread::sleep_for(boost::chrono::milliseconds(ms));
#endif
} }
} } } }