Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
frechet::app::WorkerJobHandle Class Reference

Detailed Description

Thread safe access to a WorkerJob.

Is automatically reset when the Job finishes.

Author
Peter Schäfer

Definition at line 85 of file workerthread.h.

#include <workerthread.h>

Public Member Functions

 WorkerJobHandle ()
 default constructor with no job More...
 
void startJob (WorkerJob *new_job)
 start a new job More...
 
void cancelJob ()
 request the job to be cancelled More...
 
void invalidate (WorkerJob *ajob)
 release control of the WorkerJob object More...
 
void shutDown ()
 cancel all remaining tasks and shut down the global QThreaPool More...
 

Private Attributes

QMutex mut
 mutex protects read/write access. More...
 
WorkerJobjob
 the actual Worker Job object. More...
 

Constructor & Destructor Documentation

◆ WorkerJobHandle()

frechet::app::WorkerJobHandle::WorkerJobHandle ( )
inline

default constructor with no job

Definition at line 94 of file workerthread.h.

Member Function Documentation

◆ cancelJob()

void WorkerJobHandle::cancelJob ( )

request the job to be cancelled

Note that this method does not stop the long-running tasks immediately. It only raises the canclJob flag. Long-running tasks are expected to poll the flag in regular intervals, and throw an InterruptedException. The exception is caught by the run() method.

Definition at line 33 of file workerthread.cpp.

◆ invalidate()

void WorkerJobHandle::invalidate ( WorkerJob ajob)

release control of the WorkerJob object

Parameters
ajoba worker job

Definition at line 22 of file workerthread.cpp.

◆ shutDown()

void WorkerJobHandle::shutDown ( )

cancel all remaining tasks and shut down the global QThreaPool

Definition at line 39 of file workerthread.cpp.

◆ startJob()

void WorkerJobHandle::startJob ( WorkerJob new_job)

start a new job

Parameters
new_jobpointer to job

Note: ownership of job object passes to QThreadPool. Do not delete the object youself!

Definition at line 11 of file workerthread.cpp.

Member Data Documentation

◆ job

WorkerJob* frechet::app::WorkerJobHandle::job
private

the actual Worker Job object.

Definition at line 91 of file workerthread.h.

◆ mut

QMutex frechet::app::WorkerJobHandle::mut
private

mutex protects read/write access.

Definition at line 89 of file workerthread.h.


The documentation for this class was generated from the following files: