#812·crossbeam

Provide an example for crossbeam-deque

Author: stevenliebregtCreated Apr 7, 2022Updated Feb 21, 2026
Labelscrossbeam-dequedocs

Hi, I think I'd be nice if there was a bit of an example on how to use crossbeam-deque. I know there is this page https://docs.rs/crossbeam/0.8.1/crossbeam/deque/index.html, but I'm having trouble imagining how it would look like in its entirety. For example, is that find_task<T> method part of a worker thread?

Perhaps some more context is nice to understand my question, I'm trying to implement the following:

I have 2 files which I'd like to read in parallel, and for each line of that file I want to execute a task. Let's say that I can read fast enough to theoretically execute the task 7 times in parallel, which means that I could use 8 threads per file. 1 to read the input, and 7 to process them. I thought I could use crossbeam for this. Perhaps another tool might be better suited, if so could you recommend one?