Skip to content

Conversation

@tojocky
Copy link

@tojocky tojocky commented Jan 21, 2016

Here is BlockingConcurrentQueue::wait_dequeue or BlockingConcurrentQueue::wait_dequeue_bulk with time out. tested on linux. remain to test on windows and osx. The code is almost the same as for readwritequeue.

@tojocky tojocky changed the title waid_dequeue and wait_dequeue_bulk with time out. wait_dequeue and wait_dequeue_bulk with time out. Jan 22, 2016
@cameron314
Copy link
Owner

Cool, thanks! I'll take a look as soon as I can.

@tojocky
Copy link
Author

tojocky commented Jan 23, 2016

BTW... I've seen that for wait it is used semaphores. which is good, but so nice as std::shared_future::wait_for. What do you think?

@tojocky
Copy link
Author

tojocky commented Apr 20, 2016

Hi @cameron314 , any news?

@cameron314
Copy link
Owner

Sorry! I've been busy. I'll take a look this weekend!

@cameron314
Copy link
Owner

std::shared_future, to address your earlier comment, looks really nice (I didn't know it existed before now). I'm not sure it could be used for the queue, though, because generally it's not waiting for a value/event but for a change in state (the number of available items). Semaphores are nice and simple and provide exactly what I needed, so that's what I went with.

In general, there's also no performance guarantees on most of the C++11 higher-level threading primitives -- I prefer to work with a raw OS-level construct wrapped with any data structure-specific performance enhancements necessary.

@cameron314
Copy link
Owner

I looked at the diff -- there's a lot of small things (style, mixing std::printf/std::cout, design of public API, etc.) that aren't quite the way I want them, so unfortunately I can't merge this in as-is. I'm going to use the core OS-level waiting code you added as an example, though -- thank you!

cameron314 added a commit that referenced this pull request May 2, 2016
@cameron314
Copy link
Owner

Closing this issue along with #22 -- timed waits are now implemented! Yay!

Let me know if you see an issue.

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

Successfully merging this pull request may close these issues.

2 participants