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

wait_dequeue_timed suggestion #40

Closed
yuanyinchun opened this issue Nov 23, 2016 · 3 comments
Closed

wait_dequeue_timed suggestion #40

yuanyinchun opened this issue Nov 23, 2016 · 3 comments

Comments

@yuanyinchun
Copy link

Hi,
In vs2013 __cplusplus value is 199711. c++11 version of wait_dequeue_timed's implemention is:

#if __cplusplus > 199711L // Attempts to dequeue an element; if the queue is empty, // waits until an element is available up to the specified timeout, // then dequeues it and returns true, or returns false if the timeout // expires before an element can be dequeued. // Using a negative timeout indicates an indefinite timeout, // and is thus functionally equivalent to calling wait_dequeue. template<typename U, typename Rep, typename Period> inline bool wait_dequeue_timed(U& result, std::chrono::duration<Rep, Period> const& timeout) { return wait_dequeue_timed(result, std::chrono::duration_cast<std::chrono::microseconds>(timeout).count()); } #endif

So vs2013 program unable to use wait_dequeue_timed above, but vs2013 did support chrono. Maybe another macro can be used to check compiler's c++11 support?

by the way , bool wait_dequeue_timed(U& result, std::int64_t timeout_usecs) timeout's time unit is microsecond, right?

@cameron314
Copy link
Owner

Hmm, yeah, I'll patch the #if to include VS2013+ too.
Yes, the timeout is in microseconds (abbreviated μs, or commonly us in ASCII like I've done in my code).

@cameron314
Copy link
Owner

Fixed, thanks :-)

@yuanyinchun
Copy link
Author

great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants