9#ifndef SQUID_SRC_BASE_ASYNCJOBCALLS_H
10#define SQUID_SRC_BASE_ASYNCJOBCALLS_H
49template <
class Dialer>
51CallJob(
int debugSection,
int debugLevel,
const char *fileName,
int fileLine,
52 const char *callName,
const Dialer &dialer)
59#define CallJobHere(debugSection, debugLevel, job, Class, method) \
60 CallJob((debugSection), (debugLevel), __FILE__, __LINE__, \
61 (#Class "::" #method), \
62 JobMemFun<Class>((job), &Class::method))
64#define CallJobHere1(debugSection, debugLevel, job, Class, method, arg1) \
65 CallJob((debugSection), (debugLevel), __FILE__, __LINE__, \
66 (#Class "::" #method), \
67 JobMemFun((job), &Class::method, (arg1)))
70#define JobCallback(dbgSection, dbgLevel, Dialer, job, method) \
71 asyncCall((dbgSection), (dbgLevel), #method, \
72 Dialer(CbcPointer<Dialer::DestClass>(job), &method))
98 void print(std::ostream &os)
const override { os <<
"()"; }
107template <
class Job,
class Data,
class Argument1 = Data>
113 const Data &anArg1):
JobDialer<Job>(aJob),
116 void print(std::ostream &os)
const override { os <<
'(' <<
arg1 <<
')'; }
139template <
class C,
class Argument1>
164 return call.
cancel(
"job gone");
166 return job->canBeCalled(call);
173 job->callStart(call);
177 }
catch (
const std::exception &e) {
179 call.
name <<
" threw exception: " << e.what());
182 call.
name <<
" that threw exception: " << e.what());
185 job->callException(e);
bool ScheduleCall(const char *fileName, int fileLine, const AsyncCall::Pointer &call)
RefCount< AsyncCallT< Dialer > > asyncCall(int aDebugSection, int aDebugLevel, const char *aName, const Dialer &aDialer)
NullaryMemFunT< C > JobMemFun(const CbcPointer< C > &job, typename NullaryMemFunT< C >::Method method)
AsyncCall::Pointer CallJob(int debugSection, int debugLevel, const char *fileName, int fileLine, const char *callName, const Dialer &dialer)
schedule an async job call using a dialer; use CallJobHere macros instead
bool cancel(const char *reason)
virtual bool canDial(AsyncCall &call)
JobDialer(const JobDialer &d)
void dial(AsyncCall &call)
JobDialer(const JobPointer &aJob)
JobDialer & operator=(const JobDialer &)
CbcPointer< Job > JobPointer
NullaryMemFunT(const CbcPointer< Job > &aJob, Method aMethod)
void print(std::ostream &os) const override
void print(std::ostream &os) const override
UnaryMemFunT(const CbcPointer< Job > &aJob, Method aMethod, const Data &anArg1)
void(Job::* Method)(Argument1)
#define debugs(SECTION, LEVEL, CONTENT)