Loading...
Searching...
No Matches
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::string & | get_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

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

## Detailed Description

Definition at line 1544 of file shared.cc.

## Constructor & Destructor Documentation

## Job()

LibThread::Job::Job | ( |  | ) |

inline

Definition at line 1561 of file shared.cc.

: SharedObject(), pool(NULL), deps(), pending_index(-1), fast(false),
done(false), running(false), queued(false), cancelled(false), data(NULL),
result(), args(), notify(), triggers(), prio(0)
{ set_type(type_job); }
LibThread::Job::args
vector< string > args
Definition shared.cc:1553
LibThread::Job::deps
vector< Job * > deps
Definition shared.cc:1550
LibThread::Job::done
bool done
Definition shared.cc:1557
LibThread::Job::cancelled
bool cancelled
Definition shared.cc:1560
LibThread::Job::pool
ThreadPool * pool
Definition shared.cc:1546
LibThread::Job::data
void * data
Definition shared.cc:1555
LibThread::Job::result
string result
Definition shared.cc:1554
LibThread::Job::running
bool running
Definition shared.cc:1559
LibThread::Job::fast
bool fast
Definition shared.cc:1556
LibThread::Job::pending_index
long pending_index
Definition shared.cc:1549
LibThread::Job::queued
bool queued
Definition shared.cc:1558
LibThread::Job::notify
vector< Job * > notify
Definition shared.cc:1551
LibThread::Job::triggers
vector< Trigger * > triggers
Definition shared.cc:1552
LibThread::Job::prio
long prio
Definition shared.cc:1547
LibThread::SharedObject::SharedObject
SharedObject()
Definition shared.cc:156
LibThread::SharedObject::set_type
void set_type(int type_init)
Definition shared.cc:158
LibThread::type_job
int type_job
Definition shared.cc:238
NULL
#define NULL
Definition omList.c:12

## ~Job()

LibThread::Job::~Job | ( |  | ) |

Definition at line 1608 of file shared.cc.

{
vector<Job *>::iterator it;
for (it = deps.begin(); it != deps.end(); it++) {
releaseShared(*it);
}
}
LibThread::releaseShared
void releaseShared(SharedObject *obj)
Definition shared.cc:192

## Member Function Documentation

## addDep() [1/3]

void LibThread::Job::addDep | ( | Job * | job | ) |

inline

Definition at line 1566 of file shared.cc.

{
deps.push_back(job);
}

## addDep() [2/3]

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

Definition at line 1957 of file shared.cc.

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

## addDep() [3/3]

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

Definition at line 1953 of file shared.cc.

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

## addNotify() [1/2]

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

Definition at line 1970 of file shared.cc.

{
notify.push_back(job);
if (done) {
Scheduler::notifyDeps(pool->scheduler, this);
}
}
LibThread::Scheduler::notifyDeps
static void notifyDeps(Scheduler *scheduler, Job *job)
Definition shared.cc:1824

## addNotify() [2/2]

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

Definition at line 1963 of file shared.cc.

{
notify.insert(notify.end(), jobs.begin(), jobs.end());
if (done) {
Scheduler::notifyDeps(pool->scheduler, this);
}
}

## execute()

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

pure virtual

Implemented in LibThread::AccTrigger, LibThread::CountTrigger, LibThread::EvalJob, LibThread::ExecJob, LibThread::KernelJob, LibThread::ProcJob, LibThread::ProcTrigger, LibThread::RawKernelJob, and LibThread::SetTrigger.

## ready()

bool LibThread::Job::ready | ( |  | ) |

virtual

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

Definition at line 1600 of file shared.cc.

{
vector<Job *>::iterator it;
for (it = deps.begin(); it != deps.end(); it++) {
if (!(*it)->done) return false;
}
return true;
}

## run()

void LibThread::Job::run | ( |  | ) |

Definition at line 1977 of file shared.cc.

{
if (!cancelled) {
running = true;
pool->scheduler->lock.unlock();
pool->scheduler->running++;
execute();
pool->scheduler->running--;
pool->scheduler->lock.lock();
running = false;
}
done = true;
}
LibThread::Job::execute
virtual void execute()=0

## Field Documentation

## args

vector<string> LibThread::Job::args

Definition at line 1553 of file shared.cc.

## cancelled

bool LibThread::Job::cancelled

Definition at line 1560 of file shared.cc.

## data

void* LibThread::Job::data

Definition at line 1555 of file shared.cc.

## deps

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

Definition at line 1550 of file shared.cc.

## done

bool LibThread::Job::done

Definition at line 1557 of file shared.cc.

## fast

bool LibThread::Job::fast

Definition at line 1556 of file shared.cc.

## id

size_t LibThread::Job::id

Definition at line 1548 of file shared.cc.

## notify

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

Definition at line 1551 of file shared.cc.

## pending_index

long LibThread::Job::pending_index

Definition at line 1549 of file shared.cc.

## pool

ThreadPool* LibThread::Job::pool

Definition at line 1546 of file shared.cc.

## prio

long LibThread::Job::prio

Definition at line 1547 of file shared.cc.

## queued

bool LibThread::Job::queued

Definition at line 1558 of file shared.cc.

## result

string LibThread::Job::result

Definition at line 1554 of file shared.cc.

## running

bool LibThread::Job::running

Definition at line 1559 of file shared.cc.

## triggers

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

Definition at line 1552 of file shared.cc.

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

- Singular/dyn_modules/systhreads/shared.cc