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'.
the main MongoDB namespace
Definition: bulk_operation_builder.h:24
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
MONGO_CLIENT_API Status(MONGO_CLIENT_FUNC *saslClientAuthenticate)(DBClientWithCommands *client
Attempts to authenticate "client" using the SASL protocol.