1 Posted on kdedevelopers.org:
3 For those who are not familiar with it: ThreadWeaver is like a
4 multi-threaded make tool for application developers. It provides means to chop
5 operations into jobs and declare the way they depend on each other. When
6 started, the jobs will be executed by a pool of threads, which will
7 automagically try to find the most efficient order of execution. With the
8 lately released version 0.5, it now has job collections, job sequences, and
9 qtestlib based unit tests.
11 When ThreadWeaver was introduced at last year's KDE conference, a number of
12 concepts have been suggested for addition to it. One of the concepts where
13 collections of jobs, another one sequences. Both are now finished and have
14 been moved from the experimental to the main code base.
16 As an interesting implementation detail, JobCollections are Jobs
17 themselves. They can be created and queued, just like any other Job. This
18 allowed for the removal of all other queueing methods, making the
19 WeaverInterface class even more simple.
21 JobSequences in turn are implemented as JobCollections, but will execute all
22 jobs they contain in the order they where added. This raises an interesting
23 question - what if I add a number of sequences to a sequence? Intuitively, it
24 would be expected that the sub-sequences will be executed in the order they in
25 turn where added. This is exactly what happens. More general, ThreadWeaver's
26 job collection classes allow recursive queueing of subjobs. A number of unit
27 tests have been added to showcase this.
29 The next features to come will be pooled resources (aka Job categories). Think
30 of local IO intensive Jobs - maybe you want a maximum of 2 of those running at
31 the same time. There will be special job classes for this purpose.
33 Currently I am thinking about the best way to add the idea of progress to the
34 Job class. Of course we can use a special job class, but inheritance does not
35 seem to be the best way to go. What if what the user wants is a sequence that
36 has a progress property? On the other hand, I hesitate to simply add a
37 progress property to the Job base class. Let us see if the future brings a
38 nice idea of composition ...
40 ThreadWeaver is in KDE SVN (kdenonbeta/threadweaver).
41 Release 0.5 has been tagged in tags/others/threadweaver/0.5.