Using Steves threadsafe DCRAW to roughly double thumbnail generation speed on multicore CPUs. Now there are two update worker threads. Easy to remove if someone provides code for a more efficient distribution mechanism.

This commit is contained in:
Oliver Duis
2010-10-28 21:47:52 +02:00
parent c8cd634dbc
commit 37ea6a7380
2 changed files with 49 additions and 1 deletions

View File

@@ -67,6 +67,30 @@ class PreviewLoader : public ProcessingThread<DirEntry> {
void end ();
};
// Simple Multithreader: Harnesses two normal loader threads feeded by a round robin
// Same interface as a normal PreviewLoader to minimize effects on code
class PreviewMultiLoader {
protected:
PreviewLoader loadA,loadB;
int next;
public:
PreviewMultiLoader () { next=0; }
void setPreviewLoaderListener (PreviewLoaderListener* p);
void add (DirEntry de);
void start ();
void process ();
void remove (Glib::ustring fname);
void end ();
bool runs ();
void terminate ();
void stop ();
};
class FileCatalog : public Gtk::VBox,
public DirSelectionListener,
public PreviewLoaderListener,
@@ -82,7 +106,9 @@ class FileCatalog : public Gtk::VBox,
Glib::ustring selectedDirectory;
bool enabled;
PreviewLoader previewLoader;
// Restore PreviewLoader if the new threadsafe is not that threadsafe ;-)
//PreviewLoader previewLoader;
PreviewMultiLoader previewLoader;
FileSelectionListener* listener;
FileSelectionChangeListener* fslistener;
ImageAreaToolListener* iatlistener;