Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's not completely clear in your question, but it seems that you want to split up the work into several threads, so that the processing of tiles can begin before you finishing loading the entire set.</p> <p>Consider a <strong>multithreaded processing pipeline</strong> architecture. Assign one thread per task (loading, copying, processing), and pass around tiles between tasks via <a href="http://en.wikipedia.org/wiki/Producer-consumer_problem" rel="nofollow">Producer-Consumer</a> queues (aka BlockingQueue). To be more precise, pass around pointers (or shared pointers) to tiles to avoid needless copying.</p> <p>There doesn't seem to be a ready-made thread-safe BlockingQueue class in Qt, but you can roll-up your own using <code>QQueue</code>, <code>QWaitCondition</code>, and <code>QMutex</code>. Here are some sources of inspiration:</p> <ul> <li>Just Software Solutions' <a href="http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html" rel="nofollow">blog article</a>.</li> <li>Java's <a href="http://download.oracle.com/javase/6/docs/api/java/util/concurrent/BlockingQueue.html" rel="nofollow">BlockingQueue</a></li> <li>ZThreads's <a href="http://zthread.sourceforge.net/html/classZThread_1_1BlockingQueue.html" rel="nofollow">BlockingQueue</a></li> </ul> <p>While there isn't a ready-made BlockingQueue within Qt, it seems that using signals &amp; slots with the <a href="http://doc.qt.nokia.com/latest/threads-qobject.html#signals-and-slots-across-threads" rel="nofollow"><code>Qt::QueuedConnection</code></a> option may serve the same purpose. This Qt <a href="http://blog.qt.digia.com/blog/2006/12/04/threading-without-the-headache/" rel="nofollow">blog article</a> makes such use of signals and slots.</p> <p>You may want to combine this pipeline approach with a <strong>memory pool</strong> or <strong>free list</strong> of tiles, so that already allocated tiles are recycled in your pipeline.</p> <p>Here's a conceptual sketch of the pipeline:</p> <pre><code>TilePool -&gt; TileLoader -&gt; PCQ -&gt; TileProcessor -&gt; PCQ -&gt; TileSaver -\ ^ | \----------------------------------------------------------------/ </code></pre> <p>where <code>PCQ</code> represents a Producer-Consumer queue.</p> <p>To exploit even more parallelism, you can try <a href="http://en.wikipedia.org/wiki/Thread_pool_pattern" rel="nofollow">thread pools</a> at each stage.</p> <p>You can also consider checking out Intel's <a href="http://threadingbuildingblocks.org/" rel="nofollow">Threading Building Blocks</a>. I haven't tried it myself. Be aware of the GPL licence for the open source version.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload