41 const std::shared_ptr<AsynchronousTask>& rpTask,
42 sal_uInt32 nMillisecondsBetweenSteps,
43 sal_uInt32 nMaxTimePerStep)
45 std::shared_ptr<TimerBasedTaskExecution> pExecution(
51 if (pExecution->mpTask !=
nullptr)
52 pExecution->mpSelf = pExecution;
64 const std::weak_ptr<TimerBasedTaskExecution>& rpExecution)
66 if ( rpExecution.expired())
71 std::shared_ptr<tools::TimerBasedTaskExecution> pExecution (rpExecution);
72 pExecution->Release();
74 catch (
const std::bad_weak_ptr&)
84 std::shared_ptr<AsynchronousTask> pTask,
85 sal_uInt32 nMillisecondsBetweenSteps,
86 sal_uInt32 nMaxTimePerStep)
87 : mpTask(
std::move(pTask)),
88 maTimer(
"sd TimerBasedTaskExecution maTimer"),
89 mnMaxTimePerStep(nMaxTimePerStep)
103 if (mpTask ==
nullptr)
106 if (mpTask->HasNextStep())
112 SAL_INFO(
"sd.tools", __func__ <<
": starting TimerBasedTaskExecution at " << nStartTime);
115 mpTask->RunNextStep();
117 SAL_INFO(
"sd.tools", __func__ <<
": executed step in " << nDuration);
118 if (nDuration > mnMaxTimePerStep)
121 while (mpTask->HasNextStep());
122 SAL_INFO(
"sd.tools", __func__ <<
": TimerBasedTaskExecution sleeping");
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
EmbeddedObjectRef * pObject
#define LINK(Instance, Class, Member)
#define SAL_INFO(area, stream)