23extern char *global_argv0;
50 for (
leftv t = a; t !=
NULL; t = t->next) {
55 for (
leftv t = a; t !=
NULL; t = t->next) {
66 if (
argc != n)
error =
"wrong number of arguments";
74 if (
argc < n)
error =
"wrong number of arguments";
86 void check_arg(
int i,
int type,
int type2,
const char *err) {
91 return args[
i]->Typ();
97 return args[
i]->Data();
101 return *(
T **)(
arg(
i));
104 return (
long)(
args[
i]->Data());
112 if (
i >=
argc)
return 0;
113 return args[
i]->Typ() == type;
129 result->data = (
char *) n;
162 name = std::string(
s);
251 if (table.count(
name)) {
253 if (
result->get_type() != type)
259 table.insert(pair<string,SharedObject *>(
name,
result));
273 if (table.count(
name)) {
290 if (!
lock->is_locked()) {
321 int put(
string &key,
string &value) {
327 entries.insert(pair<string, string>(key, value));
333 int get(
string &key,
string &value) {
503 ((
Region *) obj)->unlock();
520 if (r->
Typ() ==
l->Typ()) {
537 Werror(
"assign %s(%d) = %s(%d)",
545 if (r->
Typ() ==
l->Typ()) {
560 Werror(
"assign %s(%d) = %s(%d)",
571 if (lt !=
DEF_CMD && lt != rt) {
574 Werror(
"cannot assign %s (%d) to %s (%d)\n", rn, rt, ln, lt);
582 return obj->
op2(op,
res, a1, a2);
587 return obj->
op3(op,
res, a1, a2, a3);
594 return omStrDup(
"<uninitialized shared object>");
597 const char *type_name =
"unknown";
599 type_name =
"channel";
601 type_name =
"atomic_table";
603 type_name =
"shared_table";
605 type_name =
"atomic_list";
607 type_name =
"shared_list";
609 type_name =
"syncvar";
611 type_name =
"region";
613 type_name =
"regionlock";
615 sprintf(
buf,
"<thread #%s>",
name.c_str());
619 if (
name.size() > 0) {
621 sprintf(
buf,
"<threadpool \"%.40s\"@%p>",
name.c_str(), obj);
624 sprintf(
buf,
"<threadpool @%p>", obj);
628 if (
name.size() > 0) {
630 sprintf(
buf,
"<job \"%.40s\"@%p>",
name.c_str(), obj);
633 sprintf(
buf,
"<job @%p>", obj);
637 if (
name.size() > 0) {
639 sprintf(
buf,
"<trigger \"%.40s\"@%p>",
name.c_str(), obj);
642 sprintf(
buf,
"<trigger @%p>", obj);
645 sprintf(
buf,
"<unknown type %d>", type);
648 sprintf(
buf,
"<%s \"%.40s\">", type_name,
name.c_str());
656 return omStrDup(
"<uninitialized region lock>");
657 sprintf(
buf,
"<region lock \"%.40s\">", obj->
get_name().c_str());
668 for (
int i=1;
i<=n;
i++) {
700 return (
char *)(arg->
Data());
724 if (
s.size() == 0)
return;
745 const char *procname,
const vector<leftv> &argv)
752 Werror(
"procedure \"%s\" not found", procname);
758 for (
unsigned i = 0;
i < argv.size();
i++) {
760 tail = &(*tail)->
next;
767 Werror(
"procedure call of \"%s\" failed", procname);
778 string uri =
str(arg);
792 string uri =
str(arg);
813 ((
TxTable *) obj)->set_region(region);
830 ((
TxList *) obj)->set_region(region);
841 string uri =
str(arg);
854 string uri =
str(arg);
867 string uri =
str(arg);
880 string uri =
str(arg);
893 string uri =
str(arg);
896 int type = obj ? obj->
get_type() : -1;
897 const char *type_name =
"undefined";
899 type_name =
"channel";
901 type_name =
"atomic_table";
903 type_name =
"shared_table";
905 type_name =
"atomic_list";
907 type_name =
"shared_list";
909 type_name =
"syncvar";
911 type_name =
"region";
913 type_name =
"regionlock";
924 string uri =
str(arg);
928 WerrorS(
"bindSharedObject: cannot find object");
940 WerrorS(
"getTable: not a valid table");
944 WerrorS(
"getTable: not a valid table key");
949 WerrorS(
"getTable: table has not been initialized");
952 string key = (
char *)(arg->
next->
Data());
954 int success = table->
get(key, value);
956 WerrorS(
"getTable: region not acquired");
960 WerrorS(
"getTable: key not found");
973 WerrorS(
"inTable: not a valid table");
977 WerrorS(
"inTable: not a valid table key");
982 WerrorS(
"inTable: table has not been initialized");
985 string key = (
char *)(arg->
next->
Data());
986 int success = table->
check(key);
988 WerrorS(
"inTable: region not acquired");
992 result->data = (
char *)(
long)(success);
1000 WerrorS(
"putTable: not a valid table");
1004 WerrorS(
"putTable: not a valid table key");
1009 WerrorS(
"putTable: table has not been initialized");
1012 string key = (
char *)(arg->
next->
Data());
1014 int success = table->
put(key, value);
1016 WerrorS(
"putTable: region not acquired");
1027 WerrorS(
"getList: not a valid list (atomic or shared)");
1031 WerrorS(
"getList: index must be an integer");
1036 WerrorS(
"getList: list has not been initialized");
1041 int success = list->get(
index, value);
1043 WerrorS(
"getList: region not acquired");
1047 WerrorS(
"getList: no value at position");
1060 WerrorS(
"putList: not a valid list (shared or atomic)");
1064 WerrorS(
"putList: index must be an integer");
1069 WerrorS(
"putList: list has not been initialized");
1074 int success = list->put(
index, value);
1076 WerrorS(
"putList: region not acquired");
1090 WerrorS(
"lockRegion: region is already locked");
1105 WerrorS(
"lockRegion: region is already locked");
1122 WerrorS(
"unlockRegion: region is not locked");
1134 WerrorS(
"sendChannel: argument is not a channel");
1139 WerrorS(
"sendChannel: channel has not been initialized");
1151 WerrorS(
"receiveChannel: argument is not a channel");
1156 WerrorS(
"receiveChannel: channel has not been initialized");
1159 string item = channel->
receive();
1170 WerrorS(
"statChannel: argument is not a channel");
1175 WerrorS(
"receiveChannel: channel has not been initialized");
1178 long n = channel->
count();
1180 result->data = (
char *)n;
1188 WerrorS(
"writeSyncVar: argument is not a syncvar");
1193 WerrorS(
"writeSyncVar: syncvar has not been initialized");
1197 WerrorS(
"writeSyncVar: variable already has a value");
1208 cmd.
check_init(0,
"syncvar has not been initialized");
1212 char *procname = (
char *) cmd.
arg(1);
1237 WerrorS(
"readSyncVar: argument is not a syncvar");
1242 WerrorS(
"readSyncVar: syncvar has not been initialized");
1245 string item = syncvar->
read();
1256 WerrorS(
"statSyncVar: argument is not a syncvar");
1261 WerrorS(
"statSyncVar: syncvar has not been initialized");
1264 int init = syncvar->
check();
1266 result->data = (
char *)(
long) init;
1277 int type = lintree.
get_prev<
int>();
1302 if (type != 0)
return;
1303 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
1317 if (type != 0)
return;
1318 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
1329#define MAX_THREADS 128
1372#ifdef ENABLE_THREADS
1395 case '\0':
case 'q':
1432 void *arg,
const char **
error) {
1440 ts->
parent = pthread_self();
1450 *
error =
"createThread: internal error: failed to create thread";
1456 if (
error) *
error =
"createThread: too many threads";
1471 pthread_join(ts->
id,
NULL);
1487 thread->set_name(
name);
1497 cmd.
report(
"thread support not available");
1498 if (!cmd.
ok())
return cmd.
status();
1509 if (ts && ts->
parent != pthread_self()) {
1517 pthread_join(ts->
id,
NULL);
1521 thread->clearThreadState();
1530 WerrorS(
"joinThread: argument is not a thread");
1535 WerrorS(
"joinThread: can only be called from parent thread");
1567 deps.push_back(job);
1569 void addDep(vector<Job *> &jobs);
1573 virtual bool ready();
1587 return lhs->
id > rhs->
id;
1601 vector<Job *>::iterator it;
1602 for (it =
deps.begin(); it !=
deps.end(); it++) {
1603 if (!(*it)->done)
return false;
1609 vector<Job *>::iterator it;
1610 for (it =
deps.begin(); it !=
deps.end(); it++) {
1694 while (!q->empty()) {
1695 Job *job = q->front();
1708 info->scheduler =
this;
1726 for (
unsigned i = 0;
i <
threads.size();
i++) {
1782 vector<Job *> ¬ify = job->
notify;
1783 for (
unsigned i = 0;
i <notify.size();
i++) {
1785 if (!
next->cancelled) {
1805 info->scheduler =
this;
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;
1834 vector<Trigger *> &triggers = job->
triggers;
1836 if (triggers.size() > 0 && job->
result.size() > 0)
1838 for (
unsigned i = 0;
i < triggers.size();
i++) {
1840 if (trigger->
accept(arg)) {
1842 if (trigger->
ready())
1872 if (!my_queue->empty()) {
1873 Job *job = my_queue->front();
1954 deps.insert(
deps.end(), jobs.begin(), jobs.end());
1958 for (
long i = 0;
i < ndeps;
i++) {
1959 deps.push_back(jobs[
i]);
1980 pool->scheduler->lock.unlock();
1981 pool->scheduler->running++;
1983 pool->scheduler->running--;
1984 pool->scheduler->lock.lock();
2014 l->Init(
args.size());
2015 for (
unsigned i = 0;
i <
args.size();
i++) {
2017 memcpy(&
l->m[
i], val,
sizeof(*val));
2021 memset(&val, 0,
sizeof(val));
2069 long value = (long) arg->
Data();
2070 if (value < 0 || value >=
count)
return;
2071 if (
set[value])
return;
2098 pool->scheduler->lock.unlock();
2100 for (
unsigned i = 0;
i <
args.size();
i++) {
2119 pool->scheduler->lock.lock();
2133 n = (long) cmd.
arg(0);
2134 if (n < 0) cmd.
report(
"number of threads must be non-negative");
2135 else if (n >= 256) cmd.
report(
"number of threads too large");
2137 cmd.
report(
"in single-threaded mode, number of threads must be zero");
2142 for (
int i = 0;
i <n;
i++) {
2172 return cmd.
abort(
"second argument must not be empty");
2173 for (
int i = 0;
i < n;
i++) {
2175 return cmd.
abort(
"second argument must be a list of integers");
2182 for (
int i = 0;
i < n;
i++) {
2183 s += (long) (
l->m[
i].Data());
2187 for (
int i = 0;
i < n;
i++) {
2188 long m = (long) (
l->m[
i].Data());
2191 for (
int j = 0;
j <
m;
j++) {
2216 for (
int i = 0;
i <nthreads;
i++) {
2248 cmd.
check_init(0,
"threadpool not initialized");
2254 r = sched->threadpool_size(pool);
2255 sched->lock.unlock();
2266 cmd.
check_init(0,
"threadpool not initialized");
2280 cmd.
check_init(0,
"threadpool not initialized");
2286 sched->lock.unlock();
2296 cmd.
check_init(0,
"threadpool not initialized");
2301 sched->set_maxconcurrency(cmd.
int_arg(1));
2302 sched->lock.unlock();
2312 cmd.
check_init(0,
"threadpool not initialized");
2313 if (cmd.
nargs() > 1)
2336 cmd.
report(
"no current threadpool");
2344 cmd.
check_init(0,
"threadpool not initialized");
2385 for (
unsigned i = 0;
i <
args.size();
i++) {
2388 for (
unsigned i = 0;
i <
deps.size();
i++) {
2407 for (
unsigned i = 0;
i <
args.size();
i++) {
2410 for (
unsigned i = 0;
i <
deps.size();
i++) {
2414 memset(&val, 0,
sizeof(val));
2415 if (argv.size() > 0) {
2416 leftv *tail = &argv[0]->next;
2417 for (
unsigned i = 1;
i < argv.size();
i++) {
2419 tail = &(*tail)->
next;
2423 cfunc(&val, argv[0]);
2435 long ndeps =
deps.size();
2437 for (
long i = 0;
i < ndeps;
i++)
2448 "job name must be a string or quote expression");
2524 cmd.
check_init(0,
"threadpool not initialized");
2526 long prio = has_prio ? (long) cmd.
arg(has_pool) : 0L;
2527 int first_arg = has_pool + has_prio;
2529 "job argument must be a job or string");
2531 cmd.
check_init(first_arg,
"job not initialized");
2532 if (!cmd.
ok())
return cmd.
status();
2538 return cmd.
abort(
"no current threadpool defined");
2543 job = *(
Job **)(cmd.
arg(first_arg));
2545 job =
new ProcJob((
char *)(cmd.
arg(first_arg)));
2547 if (has_pool) a = a->
next;
2548 if (has_prio) a = a->
next;
2553 return cmd.
abort(
"job has already been scheduled");
2569 return cmd.
abort(
"job has not yet been started or scheduled");
2573 return cmd.
abort(
"job has been cancelled");
2575 if (job->
result.size() == 0)
2599 return cmd.
abort(
"job has not yet been started or scheduled");
2611 if (cmd.
nargs() == 1) {
2618 cmd.
report(
"no current job");
2623 return cmd.
abort(
"job has not yet been started or scheduled");
2693 cmd.
check_init(0,
"threadpool not initialized");
2698 return cmd.
abort(
"no default threadpool");
2702 const char *kind = (
const char *)(cmd.
arg(has_pool + 0));
2703 if (0 == strcmp(kind,
"proc")) {
2706 cmd.
check_arg(has_pool + 1,
INT_CMD,
"trigger argument must be an integer");
2710 long n = (long) (cmd.
arg(has_pool + 1));
2712 return cmd.
abort(
"trigger argument must be a non-negative integer");
2713 if (0 == strcmp(kind,
"acc")) {
2715 }
else if (0 == strcmp(kind,
"count")) {
2717 }
else if (0 == strcmp(kind,
"set")) {
2719 }
else if (0 == strcmp(kind,
"proc")) {
2722 return cmd.
abort(
"unknown trigger subtype");
2734 cmd.
check_init(0,
"trigger not initialized");
2739 cmd.
report(
"incompatible argument type(s) for this trigger");
2742 if (trigger->
ready()) {
2757 "second argument must be a trigger or job");
2758 cmd.
check_init(0,
"trigger not initialized");
2759 cmd.
check_init(1,
"trigger/job not initialized");
2763 if (trigger->
pool != job->pool)
2764 return cmd.
abort(
"arguments use different threadpools");
2767 job->triggers.push_back(trigger);
2777 cmd.
check_init(0,
"trigger not initialized");
2783 pool->scheduler->lock.unlock();
2797 cmd.
check_init(0,
"threadpool not initialized");
2806 return cmd.
abort(
"no current threadpool defined");
2809 long prio = has_prio ? (long) cmd.
arg(has_pool) : 0L;
2810 int first_arg = has_pool + has_prio;
2812 jobs.push_back(*(
Job **)(cmd.
arg(first_arg)));
2814 jobs.push_back(
new ProcJob((
char *)(cmd.
arg(first_arg))));
2818 for (
int i = 0;
i < n;
i++) {
2820 return cmd.
abort(
"job argument must be a job, string, or list of jobs");
2822 for (
int i = 0;
i < n;
i++) {
2823 Job *job = *(
Job **) (
l->m[
i].Data());
2825 return cmd.
abort(
"job not initialized");
2826 jobs.push_back(job);
2829 return cmd.
abort(
"job argument must be a job, string, or list of jobs");
2833 if (has_pool) a = a->
next;
2834 if (has_prio) a = a->
next;
2837 deps.push_back(*(
Job **)(a->
Data()));
2841 for (
int i = 0;
i < n;
i++) {
2843 deps.push_back(*(
Job **)(
l->m[
i].Data()));
2852 return cmd.
abort(
"illegal dependency");
2854 for (
unsigned i = 0;
i < jobs.size();
i++) {
2857 return cmd.
abort(
"job has already been scheduled");
2861 for (
unsigned i = 0;
i < deps.size();
i++) {
2864 return cmd.
abort(
"dependency has not yet been scheduled");
2866 if (job->
pool != pool) {
2867 return cmd.
abort(
"dependency has been scheduled on a different threadpool");
2871 bool cancelled =
false;
2872 for (
unsigned i = 0;
i < jobs.size();
i++) {
2873 jobs[
i]->addDep(deps);
2875 for (
unsigned i = 0;
i < deps.size();
i++) {
2876 deps[
i]->addNotify(jobs);
2877 cancelled |= deps[
i]->cancelled;
2879 for (
unsigned i = 0;
i < jobs.size();
i++) {
2881 jobs[
i]->pool = pool;
2888 if (jobs.size() > 0)
2900 cmd.
report(
"no current job");
2926 WerrorS(
"threadEval: argument is not a thread");
2932 if (ts && ts->
parent != pthread_self()) {
2933 WerrorS(
"threadEval: can only be called from parent thread");
2938 WerrorS(
"threadEval: thread is no longer running");
2954 WerrorS(
"threadExec: argument is not a thread");
2960 if (ts && ts->
parent != pthread_self()) {
2961 WerrorS(
"threadExec: can only be called from parent thread");
2966 WerrorS(
"threadExec: thread is no longer running");
2982 int has_pool = cmd.
nargs() == 2;
2985 cmd.
check_init(0,
"threadpool not initialized");
2990 return cmd.
abort(
"no current threadpool");
2995 job->
args.push_back(expr);
3006 WerrorS(
"threadResult: argument is not a thread");
3011 if (ts && ts->
parent != pthread_self()) {
3012 WerrorS(
"threadResult: can only be called from parent thread");
3017 WerrorS(
"threadResult: thread is no longer running");
3037 cmd.
check_init(0,
"first argument is not initialized");
3039 cmd.
report(
"first argument must be a job, trigger, or threadpool");
3055 cmd.
check_init(0,
"first argument is not initialized");
3057 cmd.
report(
"first argument must be a job, trigger, or threadpool");
3075 const char *libname =
currPack->libname;
3076 if (!libname) libname =
"";
3125 fn->iiAddCproc(libname,
"adjoinThreadPool",
FALSE, adjoinThreadPool);
3126 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)
const CanonicalForm int s
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
BOOLEAN readSyncVar(leftv result, leftv arg)
static BOOLEAN getThreadPoolWorkers(leftv result, leftv arg)
BOOLEAN getTable(leftv result, leftv arg)
static BOOLEAN getThreadPoolConcurrency(leftv result, leftv arg)
ThreadState * createThread(void *(*thread_func)(ThreadState *, void *), void *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)
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)
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)
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 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)
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,...)
int SI_MOD_INIT systhreads(SModulFunctions *fn)
void pSingular_initialize_thread()
int status int void * buf
bool operator()(const Job *lhs, const Job *rhs)
int name
New type name for int.