Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a cross-platform sleep function to replace usleep #3

Closed
willyd opened this issue Aug 18, 2015 · 5 comments
Closed

Use a cross-platform sleep function to replace usleep #3

willyd opened this issue Aug 18, 2015 · 5 comments

Comments

@willyd
Copy link
Owner

willyd commented Aug 18, 2015

#include <boost/thread/thread.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

boost::this_thread::sleep(boost::posix_time::millisec(milliseconds));

or C++11

#include <chrono>
#include <thread>

std::this_thread::sleep_for(std::chrono::milliseconds(ms));
@willyd
Copy link
Owner Author

willyd commented Aug 18, 2015

The above implementation might not be sufficient to make the GPU Timer test pass.

@lunzueta
Copy link
Collaborator

In this thread some suggestions are made:
http://stackoverflow.com/questions/10918206/cross-platform-sleep-function-for-c

From these the one that I like most, because of its simplicity, is this one:

#ifdef _WINDOWS
#include <windows.h>
#else
#include <unistd.h>
#define Sleep(x) usleep((x)*1000)
#endif

Then use like this:

Sleep(how_many_milliseconds);

Maybe something similar to this could be used. Would this help?

@bhack
Copy link

bhack commented Aug 18, 2015

willyd pushed a commit that referenced this issue Sep 23, 2015
Add include and lib required for building with mxGPUArray support
@willyd
Copy link
Owner Author

willyd commented Nov 12, 2015

see issue #2

@willyd
Copy link
Owner Author

willyd commented Dec 11, 2015

@willyd willyd closed this as completed Dec 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants