My Project
Public Member Functions | Data Fields
LibThread::Job Class Referenceabstract

Public Member Functions

 Job ()
 
 ~Job ()
 
void addDep (Job *job)
 
void addDep (vector< Job * > &jobs)
 
void addDep (long ndeps, Job **jobs)
 
void addNotify (vector< Job * > &jobs)
 
void addNotify (Job *job)
 
virtual bool ready ()
 
virtual void execute ()=0
 
void run ()
 
- Public Member Functions inherited from LibThread::SharedObject
 SharedObject ()
 
virtual ~SharedObject ()
 
void set_type (int type_init)
 
int get_type ()
 
void set_name (std::string &name_init)
 
void set_name (const char *s)
 
std::stringget_name ()
 
void incref (int by=1)
 
long decref ()
 
long getref ()
 
virtual BOOLEAN op2 (int op, leftv res, leftv a1, leftv a2)
 
virtual BOOLEAN op3 (int op, leftv res, leftv a1, leftv a2, leftv a3)
 

Data Fields

ThreadPoolpool
 
long prio
 
size_t id
 
long pending_index
 
vector< Job * > deps
 
vector< Job * > notify
 
vector< Trigger * > triggers
 
vector< stringargs
 
string result
 
void * data
 
bool fast
 
bool done
 
bool queued
 
bool running
 
bool cancelled
 

Detailed Description

Definition at line 1549 of file shared.cc.

Constructor & Destructor Documentation

◆ Job()

LibThread::Job::Job ( )
inline

Definition at line 1566 of file shared.cc.

1566 : SharedObject(), pool(NULL), deps(), pending_index(-1), fast(false),
1567 done(false), running(false), queued(false), cancelled(false), data(NULL),
1568 result(), args(), notify(), triggers(), prio(0)
1569 { set_type(type_job); }
vector< string > args
Definition: shared.cc:1558
vector< Job * > deps
Definition: shared.cc:1555
bool cancelled
Definition: shared.cc:1565
ThreadPool * pool
Definition: shared.cc:1551
void * data
Definition: shared.cc:1560
string result
Definition: shared.cc:1559
long pending_index
Definition: shared.cc:1554
vector< Job * > notify
Definition: shared.cc:1556
vector< Trigger * > triggers
Definition: shared.cc:1557
void set_type(int type_init)
Definition: shared.cc:163
int type_job
Definition: shared.cc:243
#define NULL
Definition: omList.c:12

◆ ~Job()

LibThread::Job::~Job ( )

Definition at line 1613 of file shared.cc.

1613 {
1614 vector<Job *>::iterator it;
1615 for (it = deps.begin(); it != deps.end(); it++) {
1616 releaseShared(*it);
1617 }
1618}
void releaseShared(SharedObject *obj)
Definition: shared.cc:197

Member Function Documentation

◆ addDep() [1/3]

void LibThread::Job::addDep ( Job job)
inline

Definition at line 1571 of file shared.cc.

1571 {
1572 deps.push_back(job);
1573 }

◆ addDep() [2/3]

void LibThread::Job::addDep ( long  ndeps,
Job **  jobs 
)

Definition at line 1962 of file shared.cc.

1962 {
1963 for (long i = 0; i < ndeps; i++) {
1964 deps.push_back(jobs[i]);
1965 }
1966}
int i
Definition: cfEzgcd.cc:132

◆ addDep() [3/3]

void LibThread::Job::addDep ( vector< Job * > &  jobs)

Definition at line 1958 of file shared.cc.

1958 {
1959 deps.insert(deps.end(), jobs.begin(), jobs.end());
1960}

◆ addNotify() [1/2]

void LibThread::Job::addNotify ( Job job)

Definition at line 1975 of file shared.cc.

1975 {
1976 notify.push_back(job);
1977 if (done) {
1979 }
1980}
static void notifyDeps(Scheduler *scheduler, Job *job)
Definition: shared.cc:1829
Scheduler * scheduler
Definition: shared.cc:1635

◆ addNotify() [2/2]

void LibThread::Job::addNotify ( vector< Job * > &  jobs)

Definition at line 1968 of file shared.cc.

1968 {
1969 notify.insert(notify.end(), jobs.begin(), jobs.end());
1970 if (done) {
1972 }
1973}

◆ execute()

virtual void LibThread::Job::execute ( )
pure virtual

◆ ready()

bool LibThread::Job::ready ( )
virtual

Reimplemented in LibThread::AccTrigger, LibThread::CountTrigger, LibThread::SetTrigger, and LibThread::ProcTrigger.

Definition at line 1605 of file shared.cc.

1605 {
1606 vector<Job *>::iterator it;
1607 for (it = deps.begin(); it != deps.end(); it++) {
1608 if (!(*it)->done) return false;
1609 }
1610 return true;
1611}

◆ run()

void LibThread::Job::run ( )

Definition at line 1982 of file shared.cc.

1982 {
1983 if (!cancelled) {
1984 running = true;
1987 execute();
1989 pool->scheduler->lock.lock();
1990 running = false;
1991 }
1992 done = true;
1993}
virtual void execute()=0
void lock()
Definition: thread.h:46
void unlock()
Definition: thread.h:57

Field Documentation

◆ args

vector<string> LibThread::Job::args

Definition at line 1558 of file shared.cc.

◆ cancelled

bool LibThread::Job::cancelled

Definition at line 1565 of file shared.cc.

◆ data

void* LibThread::Job::data

Definition at line 1560 of file shared.cc.

◆ deps

vector<Job *> LibThread::Job::deps

Definition at line 1555 of file shared.cc.

◆ done

bool LibThread::Job::done

Definition at line 1562 of file shared.cc.

◆ fast

bool LibThread::Job::fast

Definition at line 1561 of file shared.cc.

◆ id

size_t LibThread::Job::id

Definition at line 1553 of file shared.cc.

◆ notify

vector<Job *> LibThread::Job::notify

Definition at line 1556 of file shared.cc.

◆ pending_index

long LibThread::Job::pending_index

Definition at line 1554 of file shared.cc.

◆ pool

ThreadPool* LibThread::Job::pool

Definition at line 1551 of file shared.cc.

◆ prio

long LibThread::Job::prio

Definition at line 1552 of file shared.cc.

◆ queued

bool LibThread::Job::queued

Definition at line 1563 of file shared.cc.

◆ result

string LibThread::Job::result

Definition at line 1559 of file shared.cc.

◆ running

bool LibThread::Job::running

Definition at line 1564 of file shared.cc.

◆ triggers

vector<Trigger *> LibThread::Job::triggers

Definition at line 1557 of file shared.cc.


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