-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththreading.lisp
38 lines (29 loc) · 1.09 KB
/
threading.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(in-package :rationalsimplex)
;;;;; Multithreading support definitions
;;;;;
;;;;; Macro definitions which allow the offloading of
;;;;; expensive computations to seperate threads, implementation-dependent
;;;;;
;(defconstant +thread-system+ (car (intersection *features* '(:sb-thread))))
(defconstant +thread-system+ nil)
;;;;; Thread operations
(defmacro thread-launch (thread-holder fn)
(let* ((str (princ-to-string thread-holder))
(name (subseq str 1 (1- (length str)))))
(case +thread-system+
((nil)
`(setf ,thread-holder (multiple-value-list (funcall ,fn))))
((:sb-thread)
`(setf ,thread-holder (sb-thread:make-thread ,fn :name ,name))))))
(defmacro thread-result (thread-holder)
`(prog1
,(case +thread-system+
((nil)
`(values-list ,thread-holder))
((:sb-thread)
`(sb-thread:join-thread ,thread-holder)))
(setf ,thread-holder nil)))
;;;;; Rational simplex thread lock definitions
(defparameter *dse-ftran-thread* nil)
(defparameter *basis-matrix-factor-thread* nil)
(defparameter *dse-weight-update-thread* nil)