20 #include <boost/scoped_ptr.hpp>
21 #include <boost/utility.hpp>
25 #include "mongo/base/status.h"
55 virtual std::string name()
const = 0;
67 virtual void run() = 0;
70 enum State { NotStarted, Running, Done };
102 bool wait(
unsigned msTimeOut = 0);
107 State getState()
const;
108 bool running()
const;
111 const bool _selfDelete;
114 const boost::scoped_ptr<JobStatus> _status;
Status cancel()
If the job has not yet started, transitions the job to the 'done' state immediately, such that subsequent calls to 'go' are ignored, and notifies any waiters waiting in 'wait'.
Status represents an error state or the absence thereof.
Definition: status.h:50
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
bool wait(unsigned msTimeOut=0)
wait for completion.
BackgroundJob(bool selfDelete=false)
sub-class must instantiate the BackgroundJob
virtual void run()=0
define this to do your work.
Background thread dispatching.
Definition: background.h:45