- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have an idea that I'd like to implement, but I don't know where to start.
The class I intend to write is a disk intensive task one, so I'd like to have its users submit data to be written to disk, and return immediately before the actual disk operation. I believe this could be done with this:
- concurrent_queue will be used to submit data to be written, the function will enqueue and exit immediately
- parallel_do or similar construct that monitors the queue and does the hard work
- the infinite loop should, I believe, run a separate thread
I don't think what I've written corresponds to the best implementation, or it suits TBB the best.
Do you have any suggestions?
Thank you!
Franco
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Franco!
Your idea is similar that we have in fgbzip2 example. This Flow Graph example uses async_node to read/write file asynchronously.
Thanks,
Nikita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Nikita. I find it really cool, but probably more complicated than needed.
Is there an easier way of achieving this?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suppose that concurrent queue with infinite thread is the easiest way to achieve what you want.
You could also try this approach, but it is a little bit more complex.
Nikita
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page