28extern char *global_argv0;
55 for (
leftv t = a; t !=
NULL; t = t->next) {
60 for (
leftv t = a; t !=
NULL; t = t->next) {
71 if (
argc != n)
error =
"wrong number of arguments";
75 if (argc < lo || argc > hi)
error =
"wrong number of arguments";
79 if (
argc < n)
error =
"wrong number of arguments";
91 void check_arg(
int i,
int type,
int type2,
const char *err) {
104 template <
typename T>
106 return *(
T **)(
arg(
i));
117 if (
i >=
argc)
return 0;
256 if (table.count(
name)) {
258 if (
result->get_type() != type)
264 table.insert(pair<string,SharedObject *>(
name,
result));
278 if (table.count(
name)) {
326 int put(
string &key,
string &value) {
332 entries.insert(pair<string, string>(key, value));
338 int get(
string &key,
string &value) {
508 ((
Region *) obj)->unlock();
525 if (r->
Typ() ==
l->Typ()) {
542 Werror(
"assign %s(%d) = %s(%d)",
550 if (r->
Typ() ==
l->Typ()) {
565 Werror(
"assign %s(%d) = %s(%d)",
576 if (lt !=
DEF_CMD && lt != rt) {
579 Werror(
"cannot assign %s (%d) to %s (%d)\n", rn, rt, ln, lt);
587 return obj->
op2(op,
res, a1, a2);
592 return obj->
op3(op,
res, a1, a2, a3);
599 return omStrDup(
"<uninitialized shared object>");
602 const char *type_name =
"unknown";
604 type_name =
"channel";
606 type_name =
"atomic_table";
608 type_name =
"shared_table";
610 type_name =
"atomic_list";
612 type_name =
"shared_list";
614 type_name =
"syncvar";
616 type_name =
"region";
618 type_name =
"regionlock";
620 sprintf(
buf,
"<thread #%s>",
name.c_str());
624 if (
name.size() > 0) {
626 sprintf(
buf,
"<threadpool \"%.40s\"@%p>",
name.c_str(), obj);
629 sprintf(
buf,
"<threadpool @%p>", obj);
633 if (
name.size() > 0) {
635 sprintf(
buf,
"<job \"%.40s\"@%p>",
name.c_str(), obj);
638 sprintf(
buf,
"<job @%p>", obj);
642 if (
name.size() > 0) {
644 sprintf(
buf,
"<trigger \"%.40s\"@%p>",
name.c_str(), obj);
647 sprintf(
buf,
"<trigger @%p>", obj);
650 sprintf(
buf,
"<unknown type %d>", type);
653 sprintf(
buf,
"<%s \"%.40s\">", type_name,
name.c_str());
661 return omStrDup(
"<uninitialized region lock>");
662 sprintf(
buf,
"<region lock \"%.40s\">", obj->
get_name().c_str());
673 for (
int i=1;
i<=n;
i++) {
705 return (
char *)(arg->
Data());
729 if (
s.size() == 0)
return;
750 const char *procname,
const vector<leftv> &argv)
757 Werror(
"procedure \"%s\" not found", procname);
763 for (
int i = 0;
i < argv.size();
i++) {
765 tail = &(*tail)->
next;
772 Werror(
"procedure call of \"%s\" failed", procname);
783 string uri =
str(arg);
797 string uri =
str(arg);
818 ((
TxTable *) obj)->set_region(region);
835 ((
TxList *) obj)->set_region(region);
846 string uri =
str(arg);
859 string uri =
str(arg);
872 string uri =
str(arg);
885 string uri =
str(arg);
898 string uri =
str(arg);
901 int type = obj ? obj->
get_type() : -1;
902 const char *type_name =
"undefined";
904 type_name =
"channel";
906 type_name =
"atomic_table";
908 type_name =
"shared_table";
910 type_name =
"atomic_list";
912 type_name =
"shared_list";
914 type_name =
"syncvar";
916 type_name =
"region";
918 type_name =
"regionlock";
929 string uri =
str(arg);
933 WerrorS(
"bindSharedObject: cannot find object");
945 WerrorS(
"getTable: not a valid table");
949 WerrorS(
"getTable: not a valid table key");
954 WerrorS(
"getTable: table has not been initialized");
957 string key = (
char *)(arg->
next->
Data());
959 int success = table->
get(key, value);
961 WerrorS(
"getTable: region not acquired");
965 WerrorS(
"getTable: key not found");
978 WerrorS(
"inTable: not a valid table");
982 WerrorS(
"inTable: not a valid table key");
987 WerrorS(
"inTable: table has not been initialized");
990 string key = (
char *)(arg->
next->
Data());
991 int success = table->
check(key);
993 WerrorS(
"inTable: region not acquired");
997 result->data = (
char *)(
long)(success);
1005 WerrorS(
"putTable: not a valid table");
1009 WerrorS(
"putTable: not a valid table key");
1014 WerrorS(
"putTable: table has not been initialized");
1017 string key = (
char *)(arg->
next->
Data());
1019 int success = table->
put(key, value);
1021 WerrorS(
"putTable: region not acquired");
1032 WerrorS(
"getList: not a valid list (atomic or shared)");
1036 WerrorS(
"getList: index must be an integer");
1041 WerrorS(
"getList: list has not been initialized");
1046 int success = list->
get(
index, value);
1048 WerrorS(
"getList: region not acquired");
1052 WerrorS(
"getList: no value at position");
1065 WerrorS(
"putList: not a valid list (shared or atomic)");
1069 WerrorS(
"putList: index must be an integer");
1074 WerrorS(
"putList: list has not been initialized");
1079 int success = list->
put(
index, value);
1081 WerrorS(
"putList: region not acquired");
1095 WerrorS(
"lockRegion: region is already locked");
1110 WerrorS(
"lockRegion: region is already locked");
1127 WerrorS(
"unlockRegion: region is not locked");
1139 WerrorS(
"sendChannel: argument is not a channel");
1144 WerrorS(
"sendChannel: channel has not been initialized");
1156 WerrorS(
"receiveChannel: argument is not a channel");
1161 WerrorS(
"receiveChannel: channel has not been initialized");
1164 string item = channel->
receive();
1175 WerrorS(
"statChannel: argument is not a channel");
1180 WerrorS(
"receiveChannel: channel has not been initialized");
1183 long n = channel->
count();
1185 result->data = (
char *)n;
1193 WerrorS(
"writeSyncVar: argument is not a syncvar");
1198 WerrorS(
"writeSyncVar: syncvar has not been initialized");
1202 WerrorS(
"writeSyncVar: variable already has a value");
1213 cmd.
check_init(0,
"syncvar has not been initialized");
1217 char *procname = (
char *) cmd.
arg(1);
1242 WerrorS(
"readSyncVar: argument is not a syncvar");
1247 WerrorS(
"readSyncVar: syncvar has not been initialized");
1250 string item = syncvar->
read();
1261 WerrorS(
"statSyncVar: argument is not a syncvar");
1266 WerrorS(
"statSyncVar: syncvar has not been initialized");
1282 int type = lintree.
get_prev<
int>();
1307 if (type != 0)
return;
1308 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
1322 if (type != 0)
return;
1323 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
1334#define MAX_THREADS 128
1377#ifdef ENABLE_THREADS
1400 case '\0':
case 'q':
1437 void *arg,
const char **
error) {
1445 ts->
parent = pthread_self();
1455 *
error =
"createThread: internal error: failed to create thread";
1461 if (
error) *
error =
"createThread: too many threads";
1476 pthread_join(ts->
id,
NULL);
1502 cmd.
report(
"thread support not available");
1503 if (!cmd.
ok())
return cmd.
status();
1514 if (ts && ts->
parent != pthread_self()) {
1522 pthread_join(ts->
id,
NULL);
1535 WerrorS(
"joinThread: argument is not a thread");
1540 WerrorS(
"joinThread: can only be called from parent thread");
1572 deps.push_back(job);
1574 void addDep(vector<Job *> &jobs);
1578 virtual bool ready();
1592 return lhs->
id > rhs->
id;
1606 vector<Job *>::iterator it;
1607 for (it =
deps.begin(); it !=
deps.end(); it++) {
1608 if (!(*it)->done)
return false;
1614 vector<Job *>::iterator it;
1615 for (it =
deps.begin(); it !=
deps.end(); it++) {
1699 while (!q->empty()) {
1700 Job *job = q->front();
1713 info->scheduler =
this;
1787 vector<Job *> ¬ify = job->
notify;
1788 for (
int i = 0;
i <notify.size();
i++) {
1790 if (!
next->cancelled) {
1810 info->scheduler =
this;
1830 vector<Job *> ¬ify = job->
notify;
1831 job->
incref(notify.size());
1832 for (
int i = 0;
i <notify.size();
i++) {
1834 if (!
next->queued &&
next->ready() && !
next->cancelled) {
1835 next->queued =
true;
1839 vector<Trigger *> &triggers = job->
triggers;
1841 if (triggers.size() > 0 && job->
result.size() > 0)
1843 for (
int i = 0;
i < triggers.size();
i++) {
1845 if (trigger->
accept(arg)) {
1847 if (trigger->
ready())
1877 if (!my_queue->empty()) {
1878 Job *job = my_queue->front();
1959 deps.insert(
deps.end(), jobs.begin(), jobs.end());
1963 for (
long i = 0;
i < ndeps;
i++) {
1964 deps.push_back(jobs[
i]);
2019 l->Init(
args.size());
2020 for (
int i = 0;
i <
args.size();
i++) {
2022 memcpy(&
l->m[
i], val,
sizeof(*val));
2026 memset(&val, 0,
sizeof(val));
2074 long value = (long) arg->
Data();
2075 if (value < 0 || value >=
count)
return;
2076 if (
set[value])
return;
2105 for (
int i = 0;
i <
args.size();
i++) {
2138 n = (long) cmd.
arg(0);
2139 if (n < 0) cmd.
report(
"number of threads must be non-negative");
2140 else if (n >= 256) cmd.
report(
"number of threads too large");
2142 cmd.
report(
"in single-threaded mode, number of threads must be zero");
2147 for (
int i = 0;
i <n;
i++) {
2177 return cmd.
abort(
"second argument must not be empty");
2178 for (
int i = 0;
i < n;
i++) {
2180 return cmd.
abort(
"second argument must be a list of integers");
2187 for (
int i = 0;
i < n;
i++) {
2188 s += (long) (
l->m[
i].Data());
2192 for (
int i = 0;
i < n;
i++) {
2193 long m = (long) (
l->m[
i].Data());
2196 for (
int j = 0;
j <
m;
j++) {
2221 for (
int i = 0;
i <nthreads;
i++) {
2253 cmd.
check_init(0,
"threadpool not initialized");
2259 r = sched->threadpool_size(pool);
2260 sched->lock.unlock();
2271 cmd.
check_init(0,
"threadpool not initialized");
2285 cmd.
check_init(0,
"threadpool not initialized");
2291 sched->lock.unlock();
2301 cmd.
check_init(0,
"threadpool not initialized");
2306 sched->set_maxconcurrency(cmd.
int_arg(1));
2307 sched->lock.unlock();
2317 cmd.
check_init(0,
"threadpool not initialized");
2318 if (cmd.
nargs() > 1)
2341 cmd.
report(
"no current threadpool");
2349 cmd.
check_init(0,
"threadpool not initialized");
2390 for (
int i = 0;
i <
args.size();
i++) {
2393 for (
int i = 0;
i <
deps.size();
i++) {
2412 for (
int i = 0;
i <
args.size();
i++) {
2415 for (
int i = 0;
i <
deps.size();
i++) {
2419 memset(&val, 0,
sizeof(val));
2420 if (argv.size() > 0) {
2422 for (
int i = 1;
i < argv.size();
i++) {
2424 tail = &(*tail)->
next;
2428 cfunc(&val, argv[0]);
2440 long ndeps =
deps.size();
2442 for (
long i = 0;
i < ndeps;
i++)
2453 "job name must be a string or quote expression");
2529 cmd.
check_init(0,
"threadpool not initialized");
2531 long prio = has_prio ? (long) cmd.
arg(has_pool) : 0L;
2532 int first_arg = has_pool + has_prio;
2534 "job argument must be a job or string");
2536 cmd.
check_init(first_arg,
"job not initialized");
2537 if (!cmd.
ok())
return cmd.
status();
2543 return cmd.
abort(
"no current threadpool defined");
2548 job = *(
Job **)(cmd.
arg(first_arg));
2550 job =
new ProcJob((
char *)(cmd.
arg(first_arg)));
2552 if (has_pool) a = a->
next;
2553 if (has_prio) a = a->
next;
2558 return cmd.
abort(
"job has already been scheduled");
2574 return cmd.
abort(
"job has not yet been started or scheduled");
2578 return cmd.
abort(
"job has been cancelled");
2580 if (job->
result.size() == 0)
2604 return cmd.
abort(
"job has not yet been started or scheduled");
2606 pool->cancelJob(job);
2616 if (cmd.
nargs() == 1) {
2623 cmd.
report(
"no current job");
2628 return cmd.
abort(
"job has not yet been started or scheduled");
2698 cmd.
check_init(0,
"threadpool not initialized");
2703 return cmd.
abort(
"no default threadpool");
2707 const char *kind = (
const char *)(cmd.
arg(has_pool + 0));
2708 if (0 == strcmp(kind,
"proc")) {
2711 cmd.
check_arg(has_pool + 1,
INT_CMD,
"trigger argument must be an integer");
2715 long n = (long) (cmd.
arg(has_pool + 1));
2717 return cmd.
abort(
"trigger argument must be a non-negative integer");
2718 if (0 == strcmp(kind,
"acc")) {
2720 }
else if (0 == strcmp(kind,
"count")) {
2722 }
else if (0 == strcmp(kind,
"set")) {
2724 }
else if (0 == strcmp(kind,
"proc")) {
2727 return cmd.
abort(
"unknown trigger subtype");
2739 cmd.
check_init(0,
"trigger not initialized");
2744 cmd.
report(
"incompatible argument type(s) for this trigger");
2747 if (trigger->
ready()) {
2762 "second argument must be a trigger or job");
2763 cmd.
check_init(0,
"trigger not initialized");
2764 cmd.
check_init(1,
"trigger/job not initialized");
2768 if (trigger->
pool != job->pool)
2769 return cmd.
abort(
"arguments use different threadpools");
2772 job->triggers.push_back(trigger);
2782 cmd.
check_init(0,
"trigger not initialized");
2788 pool->scheduler->lock.unlock();
2802 cmd.
check_init(0,
"threadpool not initialized");
2811 return cmd.
abort(
"no current threadpool defined");
2814 long prio = has_prio ? (long) cmd.
arg(has_pool) : 0L;
2815 int first_arg = has_pool + has_prio;
2817 jobs.push_back(*(
Job **)(cmd.
arg(first_arg)));
2819 jobs.push_back(
new ProcJob((
char *)(cmd.
arg(first_arg))));
2823 for (
int i = 0;
i < n;
i++) {
2825 return cmd.
abort(
"job argument must be a job, string, or list of jobs");
2827 for (
int i = 0;
i < n;
i++) {
2828 Job *job = *(
Job **) (
l->m[
i].Data());
2830 return cmd.
abort(
"job not initialized");
2831 jobs.push_back(job);
2834 return cmd.
abort(
"job argument must be a job, string, or list of jobs");
2838 if (has_pool) a = a->
next;
2839 if (has_prio) a = a->
next;
2842 deps.push_back(*(
Job **)(a->
Data()));
2846 for (
int i = 0;
i < n;
i++) {
2848 deps.push_back(*(
Job **)(
l->m[
i].Data()));
2857 return cmd.
abort(
"illegal dependency");
2859 for (
int i = 0;
i < jobs.size();
i++) {
2862 return cmd.
abort(
"job has already been scheduled");
2866 for (
int i = 0;
i < deps.size();
i++) {
2869 return cmd.
abort(
"dependency has not yet been scheduled");
2871 if (job->
pool != pool) {
2872 return cmd.
abort(
"dependency has been scheduled on a different threadpool");
2876 bool cancelled =
false;
2877 for (
int i = 0;
i < jobs.size();
i++) {
2878 jobs[
i]->addDep(deps);
2880 for (
int i = 0;
i < deps.size();
i++) {
2881 deps[
i]->addNotify(jobs);
2882 cancelled |= deps[
i]->cancelled;
2884 for (
int i = 0;
i < jobs.size();
i++) {
2886 jobs[
i]->pool = pool;
2893 if (jobs.size() > 0)
2905 cmd.
report(
"no current job");
2933 WerrorS(
"threadEval: argument is not a thread");
2939 if (ts && ts->
parent != pthread_self()) {
2940 WerrorS(
"threadEval: can only be called from parent thread");
2945 WerrorS(
"threadEval: thread is no longer running");
2961 WerrorS(
"threadExec: argument is not a thread");
2967 if (ts && ts->
parent != pthread_self()) {
2968 WerrorS(
"threadExec: can only be called from parent thread");
2973 WerrorS(
"threadExec: thread is no longer running");
2989 int has_pool = cmd.
nargs() == 2;
2992 cmd.
check_init(0,
"threadpool not initialized");
2997 return cmd.
abort(
"no current threadpool");
3002 job->
args.push_back(expr);
3013 WerrorS(
"threadResult: argument is not a thread");
3018 if (ts && ts->
parent != pthread_self()) {
3019 WerrorS(
"threadResult: can only be called from parent thread");
3024 WerrorS(
"threadResult: thread is no longer running");
3044 cmd.
check_init(0,
"first argument is not initialized");
3046 cmd.
report(
"first argument must be a job, trigger, or threadpool");
3062 cmd.
check_init(0,
"first argument is not initialized");
3064 cmd.
report(
"first argument must be a job, trigger, or threadpool");
3082 const char *libname =
currPack->libname;
3083 if (!libname) libname =
"";
3132 fn->iiAddCproc(libname,
"adjoinThreadPool",
FALSE, adjoinThreadPool);
3133 fn->iiAddCproc(libname,
"getAdjoinedThreadPools",
FALSE, getAdjoinedThreadPools);
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
AccTrigger(long count_init)
virtual void activate(leftv arg)
virtual bool accept(leftv arg)
void set_result(int type, long n)
int test_arg(int i, int type)
void check_init(int i, const char *err)
void report(const char *err)
BOOLEAN abort(const char *err)
void check_arg(int i, int type, int type2, const char *err)
void check_arg(int i, int type, const char *err)
void check_argc_min(int n)
void set_result(int type, void *p)
void set_result(const char *s)
void check_argc(int lo, int hi)
Command(const char *n, leftv r, leftv a)
CountTrigger(long count_init)
virtual void activate(leftv arg)
virtual bool accept(leftv arg)
ThreadState * getThreadState()
virtual ~InterpreterThread()
InterpreterThread(ThreadState *ts_init)
void addNotify(vector< Job * > &jobs)
vector< Trigger * > triggers
KernelJob(void(*func)(leftv result, leftv arg))
void(* cfunc)(leftv result, leftv arg)
ProcJob(const char *procname_init)
virtual bool accept(leftv arg)
ProcTrigger(const char *p)
virtual void activate(leftv arg)
void(* cfunc)(long ndeps, Job **deps)
RawKernelJob(void(*func)(long ndeps, Job **deps))
SharedObjectTable objects
vector< ThreadPool * > thread_owners
vector< JobQueue * > thread_queues
void addThread(ThreadPool *owner, ThreadState *thread)
ConditionVariable response
void cancelDeps(Job *job)
priority_queue< Job *, vector< Job * >, JobCompare > global_queue
ThreadState * getThread(int i)
void set_maxconcurrency(int n)
void broadcastJob(ThreadPool *pool, Job *job)
vector< ThreadState * > threads
static void notifyDeps(Scheduler *scheduler, Job *job)
static void * main(ThreadState *ts, void *arg)
void attachJob(ThreadPool *pool, Job *job)
int threadpool_size(ThreadPool *pool)
virtual void activate(leftv arg)
SetTrigger(long count_init)
virtual bool accept(leftv arg)
void set_name(std::string &name_init)
virtual BOOLEAN op3(int op, leftv res, leftv a1, leftv a2, leftv a3)
void set_name(const char *s)
virtual BOOLEAN op2(int op, leftv res, leftv a1, leftv a2)
void set_type(int type_init)
virtual ~SingularChannel()
virtual ~SingularSyncVar()
void broadcastJob(Job *job)
ThreadState * getThread(int i)
ThreadPool(Scheduler *sched, int n)
void cancelDeps(Job *job)
void addThread(ThreadState *thread)
void *(* thread_func)(ThreadState *, void *)
ConditionVariable to_cond
queue< string > from_thread
ConditionVariable from_cond
queue< string > to_thread
void set_region(Region *region_init)
virtual void activate(leftv arg)=0
virtual bool accept(leftv arg)=0
int put(size_t index, string &value)
int get(size_t index, string &value)
int put(string &key, string &value)
std::map< string, string > entries
int get(string &key, string &value)
Class used for (list of) interpreter objects.
void CleanUp(ring r=currRing)
INLINE_THIS void Init(int l=0)
void error(const char *fmt,...)
const CanonicalForm int s
const ExtensionInfo & info
< [in] sqrfree poly
void WerrorS(const char *s)
feOptIndex feGetOptIndex(const char *name)
const char * feSetOptValue(feOptIndex opt, char *optarg)
const char * Tok2Cmdname(int tok)
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
EXTERN_VAR omBin sleftv_bin
lists getList(spectrum &spec)
BOOLEAN readSyncVar(leftv result, leftv arg)
static BOOLEAN createThread(leftv result, leftv arg)
static BOOLEAN getThreadPoolWorkers(leftv result, leftv arg)
BOOLEAN getTable(leftv result, leftv arg)
static BOOLEAN getThreadPoolConcurrency(leftv result, leftv arg)
static BOOLEAN waitJob(leftv result, leftv arg)
ThreadState * createThread(void *(*thread_func)(ThreadState *, void *), void *arg)
static BOOLEAN createThreadPool(leftv result, leftv arg)
SharedObject * consSyncVar()
int not_a_uri(const char *name, leftv arg)
static BOOLEAN setThreadPoolConcurrency(leftv result, leftv arg)
static BOOLEAN scheduleJob(leftv result, leftv arg)
BOOLEAN makeSyncVar(leftv result, leftv arg)
BOOLEAN shared_check_assign(blackbox *b, leftv l, leftv r)
BOOLEAN makeSharedList(leftv result, leftv arg)
BOOLEAN shared_assign(leftv l, leftv r)
void * new_shared(SharedObject *obj)
void ref_shared(LinTree::LinTree &lintree, int by)
BOOLEAN getList(leftv result, leftv arg)
static void appendArgCopy(vector< leftv > &argv, leftv arg)
void * shared_init(blackbox *b)
BOOLEAN statChannel(leftv result, leftv arg)
BOOLEAN threadEval(leftv result, leftv arg)
void * shared_copy(blackbox *b, void *d)
SharedObject * SharedObjectPtr
BOOLEAN unlockRegion(leftv result, leftv arg)
BOOLEAN sendChannel(leftv result, leftv arg)
void * joinThread(ThreadState *ts)
Job * startJob(ThreadPool *pool, Job *job, leftv arg)
static ThreadState * newThread(void *(*thread_func)(ThreadState *, void *), void *arg, const char **error)
BOOLEAN setSharedName(leftv result, leftv arg)
static void appendArg(vector< leftv > &argv, string &s)
SharedObject * makeSharedObject(SharedObjectTable &table, Lock *lock, int type, string &name, SharedConstructor scons)
BOOLEAN writeSyncVar(leftv result, leftv arg)
std::map< std::string, SharedObject * > SharedObjectTable
BOOLEAN makeAtomicTable(leftv result, leftv arg)
static BOOLEAN startJob(leftv result, leftv arg)
BOOLEAN bindSharedObject(leftv result, leftv arg)
void report(const char *fmt, const char *name)
char * shared_string(blackbox *b, void *d)
BOOLEAN lockRegion(leftv result, leftv arg)
BOOLEAN currentJob(leftv result, leftv arg)
int wrong_num_args(const char *name, leftv arg, int n)
ThreadState * thread_state
static InterpreterThread * createInterpreterThread(const char **error)
static BOOLEAN testTrigger(leftv result, leftv arg)
static BOOLEAN createJob(leftv result, leftv arg)
ThreadPool * createThreadPool(int threads, int prioThreads=0)
BOOLEAN threadExec(leftv result, leftv arg)
BOOLEAN rlock_assign(leftv l, leftv r)
void setJobData(Job *job, void *data)
BOOLEAN putTable(leftv result, leftv arg)
BOOLEAN makeAtomicList(leftv result, leftv arg)
ThreadPool * getCurrentThreadPool()
STATIC_VAR Job * currentJobRef
static BOOLEAN createTrigger(leftv result, leftv arg)
int not_a_region(const char *name, leftv arg)
BOOLEAN currentThreadPool(leftv result, leftv arg)
void addJobArgs(Job *job, leftv arg)
void rlock_destroy(blackbox *b, void *d)
static BOOLEAN joinThread(leftv result, leftv arg)
void * interpreter_thread(ThreadState *ts, void *arg)
static BOOLEAN setThreadPoolWorkers(leftv result, leftv arg)
static BOOLEAN updateTrigger(leftv result, leftv arg)
BOOLEAN getSharedName(leftv result, leftv arg)
SharedObjectTable global_objects
SharedObject * consList()
BOOLEAN receiveChannel(leftv result, leftv arg)
BOOLEAN mainThread(leftv result, leftv arg)
void releaseShared(SharedObject *obj)
void * getJobData(Job *job)
void closeThreadPool(ThreadPool *pool, bool wait)
SharedObject * consChannel()
BOOLEAN threadPoolExec(leftv result, leftv arg)
BOOLEAN setCurrentThreadPool(leftv result, leftv arg)
BOOLEAN regionLock(leftv result, leftv arg)
BOOLEAN findSharedObject(leftv result, leftv arg)
static BOOLEAN cancelJob(leftv result, leftv arg)
BOOLEAN threadID(leftv result, leftv arg)
void makeRegionlockType(int &type, const char *name)
char * rlock_string(blackbox *b, void *d)
void encode_shared(LinTree::LinTree &lintree, leftv val)
BOOLEAN makeSharedTable(leftv result, leftv arg)
BOOLEAN typeSharedObject(leftv result, leftv arg)
Job * createJob(void(*func)(leftv result, leftv arg))
STATIC_VAR ThreadPool * currentThreadPoolRef
BOOLEAN statSyncVar(leftv result, leftv arg)
BOOLEAN shared_op2(int op, leftv res, leftv a1, leftv a2)
SharedObject * findSharedObject(SharedObjectTable &table, Lock *lock, string &name)
SharedObjectPtr(* SharedConstructor)()
BOOLEAN makeChannel(leftv result, leftv arg)
BOOLEAN shared_op3(int op, leftv res, leftv a1, leftv a2, leftv a3)
void * thread_main(void *arg)
const char * getJobName()
void acquireShared(SharedObject *obj)
static BOOLEAN jobCancelled(leftv result, leftv arg)
static BOOLEAN closeThreadPool(leftv result, leftv arg)
SharedObject * consTable()
static BOOLEAN chainTrigger(leftv result, leftv arg)
BOOLEAN makeRegion(leftv result, leftv arg)
BOOLEAN putList(leftv result, leftv arg)
static bool joinInterpreterThread(InterpreterThread *thread)
void setJobName(const char *)
static BOOLEAN createThreadPoolSet(leftv result, leftv arg)
void makeSharedType(int &type, const char *name)
void shared_destroy(blackbox *b, void *d)
static BOOLEAN executeProc(sleftv &result, const char *procname, const vector< leftv > &argv)
SharedObject * consRegion()
BOOLEAN updateSyncVar(leftv result, leftv arg)
BOOLEAN inTable(leftv result, leftv arg)
leftv getJobResult(Job *job)
void installShared(int type)
BOOLEAN threadResult(leftv result, leftv arg)
leftv decode_shared(LinTree::LinTree &lintree)
std::string to_string(leftv val)
void install(int typ, LinTreeEncodeFunc enc, LinTreeDecodeFunc dec, LinTreeRefFunc ref)
leftv from_string(std::string &str)
#define omFreeBin(addr, bin)
static int index(p_Length length, p_Ord ord)
void Werror(const char *fmt,...)
void pSingular_initialize_thread()
int SI_MOD_INIT() systhreads(SModulFunctions *fn)
int status int void * buf
bool operator()(const Job *lhs, const Job *rhs)
char name(const Variable &v)