Multithread

There is no way to create bound threads. Therefore only one signal stack and one interval timer are available in a EusLisp process. On Solaris2, the main top-level runs in a separated thread.



unix:thr-self [function]

returns the id (integer) of the thread currently running.


unix:thr-getprio id [function]

returns the execution priority of the thread specified by id.


unix:thr-setprio id newprio [function]
sets the execution priority of the thread specified by id to newprio. The smaller numerical value of newprio means the higher priority. In other words, a thread with a numerically greater newprio gets less access to CPU. Users cannot raise the execution priority higher than the process's nice value, which is usually 0.


unix:thr-getconcurrency [function]

returns the concurrency value (integer) which represents the number of threads that can run concurrently.


unix:thr-setconcurrency concurrency [function]
The concurrency value is the number of LWP in the process. If the concurrency is 1, which is the default, many threads you created are assigned to one LWP in turn even though all of them are runnable. If the program is running on a multi-processor machine and you want to utilize more than one CPU at the same time, you should set a value bigger than one to concurrency. Note that a big concurrency value let the operating system consume more resource. Usually concurrency should be smaller than or equal to the number of processors.


unix:thr-create func arg-list &optional (size 64*1024) [function]

creates a new thread with size words of Lisp stack and size bytes of C stack, and let it apply func to arg-list. The thread cannot return any results to the caller. Use of this function is discouraged.


k-okada 2013-05-21