]> git.tdb.fi Git - builder.git/blob - source/internalaction.cpp
Add class InternalAction for actions that use a thread to do their work
[builder.git] / source / internalaction.cpp
1 /* $Id$
2
3 This file is part of builder
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "internalaction.h"
9
10 InternalAction::~InternalAction()
11 {
12         delete worker;
13 }
14
15 int InternalAction::check()
16 {
17         if(!worker)  // True for dry run
18         {
19                 signal_done.emit();
20                 return 0;
21         }
22
23         if(worker->get_done())
24         {
25                 signal_done.emit();
26                 worker->join();
27                 return worker->get_error()?1:0;
28         }
29
30         return -1;
31 }
32
33 InternalAction::InternalAction(Builder &b):
34         Action(b),
35         worker(0)
36 { }
37
38
39 InternalAction::Worker::Worker():
40         done(false),
41         error(false)
42 { }