|
| Scheduler (int n) |
|
void | set_maxconcurrency (int n) |
|
int | get_maxconcurrency () |
|
int | threadpool_size (ThreadPool *pool) |
|
virtual | ~Scheduler () |
|
ThreadState * | getThread (int i) |
|
void | shutdown (bool wait) |
|
void | addThread (ThreadPool *owner, ThreadState *thread) |
|
void | attachJob (ThreadPool *pool, Job *job) |
|
void | detachJob (Job *job) |
|
void | queueJob (Job *job) |
|
void | broadcastJob (ThreadPool *pool, Job *job) |
|
void | cancelDeps (Job *job) |
|
void | cancelJob (Job *job) |
|
void | waitJob (Job *job) |
|
void | clearThreadState () |
|
| 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) |
|
Definition at line 1649 of file shared.cc.
◆ Scheduler()
LibThread::Scheduler::Scheduler |
( |
int | n | ) |
|
|
inline |
Definition at line 1668 of file shared.cc.
1668 :
1674 {
1676 }
vector< ThreadPool * > thread_owners
vector< JobQueue * > thread_queues
ConditionVariable response
priority_queue< Job *, vector< Job * >, JobCompare > global_queue
vector< ThreadState * > threads
◆ ~Scheduler()
virtual LibThread::Scheduler::~Scheduler |
( |
| ) |
|
|
inlinevirtual |
Definition at line 1691 of file shared.cc.
1691 {
1694 while (!q->empty()) {
1695 Job *job = q->front();
1696 q->pop();
1698 }
1699 }
1702 }
void releaseShared(SharedObject *obj)
◆ addThread()
◆ attachJob()
void LibThread::Scheduler::attachJob |
( |
ThreadPool * | pool, |
|
|
Job * | job ) |
|
inline |
Definition at line 1737 of file shared.cc.
1737 {
1745 }
1750 }
1752 }
void acquireShared(SharedObject *obj)
◆ broadcastJob()
void LibThread::Scheduler::broadcastJob |
( |
ThreadPool * | pool, |
|
|
Job * | job ) |
|
inline |
Definition at line 1771 of file shared.cc.
1771 {
1777 }
1778 }
1780 }
◆ cancelDeps()
void LibThread::Scheduler::cancelDeps |
( |
Job * | job | ) |
|
|
inline |
Definition at line 1781 of file shared.cc.
1781 {
1782 vector<Job *> ¬ify = job->
notify;
1783 for (
unsigned i = 0;
i <notify.size();
i++) {
1785 if (!
next->cancelled) {
1787 }
1788 }
1789 }
◆ cancelJob()
void LibThread::Scheduler::cancelJob |
( |
Job * | job | ) |
|
|
inline |
Definition at line 1790 of file shared.cc.
1790 {
1797 }
1798 }
1800 }
void cancelDeps(Job *job)
◆ clearThreadState()
void LibThread::Scheduler::clearThreadState |
( |
| ) |
|
|
inline |
◆ detachJob()
void LibThread::Scheduler::detachJob |
( |
Job * | job | ) |
|
|
inline |
◆ get_maxconcurrency()
int LibThread::Scheduler::get_maxconcurrency |
( |
| ) |
|
|
inline |
◆ getThread()
◆ main()
static void * LibThread::Scheduler::main |
( |
ThreadState * | ts, |
|
|
void * | arg ) |
|
inlinestatic |
Definition at line 1851 of file shared.cc.
1851 {
1852 SchedInfo *
info = (SchedInfo *) arg;
1855
1856
1858 ConditionVariable &
cond = scheduler->
cond;
1864 for (;;) {
1866 break;
1870 break;
1871 }
1872 if (!my_queue->empty()) {
1873 Job *job = my_queue->front();
1874 my_queue->pop();
1883 continue;
1895 continue;
1896 } else {
1898 break;
1899 }
1901 }
1902 }
1903
1904
1909 }
static void notifyDeps(Scheduler *scheduler, Job *job)
STATIC_VAR Job * currentJobRef
STATIC_VAR ThreadPool * currentThreadPoolRef
◆ notifyDeps()
static void LibThread::Scheduler::notifyDeps |
( |
Scheduler * | scheduler, |
|
|
Job * | job ) |
|
inlinestatic |
Definition at line 1824 of file shared.cc.
1824 {
1825 vector<Job *> ¬ify = job->
notify;
1826 job->
incref(notify.size());
1827 for (
unsigned i = 0;
i <notify.size();
i++) {
1829 if (!
next->queued &&
next->ready() && !
next->cancelled) {
1830 next->queued =
true;
1832 }
1833 }
1834 vector<Trigger *> &triggers = job->
triggers;
1836 if (triggers.size() > 0 && job->
result.size() > 0)
1838 for (
unsigned i = 0;
i < triggers.size();
i++) {
1839 Trigger *trigger = triggers[
i];
1840 if (trigger->
accept(arg)) {
1842 if (trigger->
ready())
1844 }
1845 }
1846 if (arg) {
1849 }
1850 }
vector< Trigger * > triggers
virtual void activate(leftv arg)=0
virtual bool accept(leftv arg)=0
void CleanUp(ring r=currRing)
EXTERN_VAR omBin sleftv_bin
leftv from_string(std::string &str)
#define omFreeBin(addr, bin)
◆ queueJob()
void LibThread::Scheduler::queueJob |
( |
Job * | job | ) |
|
|
inline |
◆ set_maxconcurrency()
void LibThread::Scheduler::set_maxconcurrency |
( |
int | n | ) |
|
|
inline |
◆ shutdown()
void LibThread::Scheduler::shutdown |
( |
bool | wait | ) |
|
|
inline |
Definition at line 1704 of file shared.cc.
1704 {
1706 SchedInfo *
info =
new SchedInfo();
1708 info->scheduler =
this;
1712 return;
1713 }
1718 }
1719 }
1724 }
1726 for (
unsigned i = 0;
i <
threads.size();
i++) {
1728 }
1729 }
static void * main(ThreadState *ts, void *arg)
void * joinThread(ThreadState *ts)
◆ threadpool_size()
int LibThread::Scheduler::threadpool_size |
( |
ThreadPool * | pool | ) |
|
|
inline |
Definition at line 1683 of file shared.cc.
1683 {
1684 int n;
1687 n++;
1688 }
1689 return n;
1690 }
◆ waitJob()
void LibThread::Scheduler::waitJob |
( |
Job * | job | ) |
|
|
inline |
Definition at line 1801 of file shared.cc.
1801 {
1803 SchedInfo *
info =
new SchedInfo();
1805 info->scheduler =
this;
1809 } else {
1811 for (;;) {
1813 break;
1814 }
1816 }
1819 }
1820 }
◆ Job
◆ cond
◆ global_queue
priority_queue<Job *, vector<Job *>, JobCompare> LibThread::Scheduler::global_queue |
|
private |
◆ jobid
size_t LibThread::Scheduler::jobid |
|
private |
◆ lock
Lock LibThread::Scheduler::lock |
◆ maxconcurrency
int LibThread::Scheduler::maxconcurrency |
|
private |
◆ nthreads
int LibThread::Scheduler::nthreads |
|
private |
◆ pending
vector<Job *> LibThread::Scheduler::pending |
|
private |
◆ response
◆ running
int LibThread::Scheduler::running |
|
private |
◆ shutdown_counter
int LibThread::Scheduler::shutdown_counter |
|
private |
◆ shutting_down
bool LibThread::Scheduler::shutting_down |
|
private |
◆ single_threaded
bool LibThread::Scheduler::single_threaded |
|
private |
◆ thread_owners
vector<ThreadPool *> LibThread::Scheduler::thread_owners |
|
private |
◆ thread_queues
vector<JobQueue *> LibThread::Scheduler::thread_queues |
|
private |
◆ threads
The documentation for this class was generated from the following file: