Tommaso Cucinotta <tomm...@lyx.org> writes: | Hi, > | I just "enjoyed" extending the Find Advanced feature to exploit multi-cores. > | It exploits QThreadPool to create "worker" threads (as many as the | underlying | physical CPUs detected by QThreadPool). Each thread searches in a single | paragraph, then "queries" the next paragraph to be searched from a | common synchronized "monitor" (see FindAdvHits::nextRange()), then | keeps going. In the end, the | first logically sequential match is returned (i.e., no alteration on the | current behavior/semantics of Find Advanced). So, if a thread searching | later paragraphs finds a hit while another thread that is searching prior | paragraphs is still searching, then the result delivery will wait till the | latter one either finds nothing, or it finds its own match (which will be | returned, in this case).
Hmm.. if an earlier match is found, the rest of the workers should be stopped. That is not really hard to do.