1 | (require :asdf) |
---|
2 | (asdf:operate 'asdf:load-op :isidorus) |
---|
3 | (xml-importer:setup-repository "textgrid.xtm" "data_base" |
---|
4 | :tm-id "http://ztt.fh-worms.de/textgrid.xtm" |
---|
5 | :xtm-id "textgrid.xtm") |
---|
6 | |
---|
7 | |
---|
8 | (defun return-all-tmcl-types-test-handler (&optional param) |
---|
9 | "similar to hunchentoot's corresponding handler - but without hunchentoot's |
---|
10 | variables, e.g. hunchentoot:content-type, ..." |
---|
11 | (declare (ignorable param)) |
---|
12 | (handler-case (let ((topic-types |
---|
13 | (isidorus-threading:with-reader-lock |
---|
14 | (json-tmcl::return-all-tmcl-types :revision 0)))) |
---|
15 | (json:encode-json-to-string |
---|
16 | (map 'list #'(lambda(y) |
---|
17 | (map 'list #'d:uri y)) |
---|
18 | (map 'list #'d:psis topic-types)))) |
---|
19 | (condition (err) (error (format nil "~a" err))))) |
---|
20 | |
---|
21 | |
---|
22 | (defun return-all-tmcl-instances-test-handler(&optional param) |
---|
23 | "similar to hunchentoot's corresponding handler - but without hunchentoot's |
---|
24 | variables, e.g. hunchentoot:content-type, ..." |
---|
25 | (declare (ignorable param)) |
---|
26 | (handler-case (let ((topic-instances |
---|
27 | (isidorus-threading:with-reader-lock |
---|
28 | (json-tmcl::return-all-tmcl-instances :revision 0)))) |
---|
29 | (json:encode-json-to-string |
---|
30 | (map 'list #'(lambda(y) |
---|
31 | (map 'list #'d:uri y)) |
---|
32 | (map 'list #'d:psis topic-instances)))) |
---|
33 | (condition (err) (error (format nil "~a" err))))) |
---|
34 | |
---|
35 | |
---|
36 | |
---|
37 | (defun return-all-topic-psis-test-handler (&optional param) |
---|
38 | "similar to hunchentoot's corresponding handler - but without hunchentoot's |
---|
39 | variables, e.g. hunchentoot:content-type, ..." |
---|
40 | (declare (ignorable param)) |
---|
41 | (handler-case (isidorus-threading:with-reader-lock |
---|
42 | (json-exporter::get-all-topic-psis :revision 0)) |
---|
43 | (condition (err) (error (format nil "~a" err))))) |
---|
44 | |
---|
45 | |
---|
46 | (defun my-thread-function-1 () |
---|
47 | (dotimes (i 100) |
---|
48 | (return-all-tmcl-types-test-handler))) |
---|
49 | |
---|
50 | |
---|
51 | (defun programm-1 (thread-fun) |
---|
52 | "bordeaux-threads" |
---|
53 | (defvar *thread-1* (bordeaux-threads:make-thread thread-fun)) |
---|
54 | (defvar *thread-2* (bordeaux-threads:make-thread thread-fun))) |
---|
55 | |
---|
56 | |
---|
57 | (defun programm-2 (thread-fun) |
---|
58 | "bordeaux-threads" |
---|
59 | (let ((thread-1 nil) |
---|
60 | (thread-2 nil) |
---|
61 | (max-iterations 150)) |
---|
62 | (do ((c1 0 (+ c1 0)) |
---|
63 | (c2 0 (+ c2 0))) |
---|
64 | ((and (>= c1 max-iterations) (>= c2 max-iterations))) |
---|
65 | (when (or (not thread-1) (not (bordeaux-threads:thread-alive-p thread-1))) |
---|
66 | (setf thread-1 (bordeaux-threads:make-thread thread-fun)) |
---|
67 | (incf c1) |
---|
68 | (format t "c1: ~a c2: ~a~%" c1 c2)) |
---|
69 | (when (or (not thread-2) (not (bordeaux-threads:thread-alive-p thread-2))) |
---|
70 | (setf thread-2 (bordeaux-threads:make-thread thread-fun)) |
---|
71 | (incf c2) |
---|
72 | (format t "c1: ~a c2: ~a~%" c1 c2))))) |
---|
73 | |
---|
74 | |
---|
75 | (defun programm-3 (thread-fun) |
---|
76 | "sb-thread" |
---|
77 | (defvar *thread-3* (sb-thread:make-thread thread-fun)) |
---|
78 | (defvar *thread-4* (sb-thread:make-thread thread-fun))) |
---|
79 | |
---|
80 | |
---|
81 | (defun programm-4 (thread-fun) |
---|
82 | "sb-thread" |
---|
83 | (let ((thread-1 nil) |
---|
84 | (thread-2 nil) |
---|
85 | (max-iterations 150)) |
---|
86 | (do ((c1 0 (+ c1 0)) |
---|
87 | (c2 0 (+ c2 0))) |
---|
88 | ((and (>= c1 max-iterations) (>= c2 max-iterations))) |
---|
89 | (when (or (not thread-1) (not (sb-thread:thread-alive-p thread-1))) |
---|
90 | (setf thread-1 (sb-thread:make-thread thread-fun)) |
---|
91 | (incf c1) |
---|
92 | (format t "c1: ~a c2: ~a~%" c1 c2)) |
---|
93 | (when (or (not thread-2) (not (sb-thread:thread-alive-p thread-2))) |
---|
94 | (setf thread-2 (sb-thread:make-thread thread-fun)) |
---|
95 | (incf c2) |
---|
96 | (format t "c1: ~a c2: ~a~%" c1 c2))))) |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | (defun main() |
---|
103 | (programm-4 #'return-all-tmcl-types-test-handler)) |
---|
104 | |
---|
105 | |
---|
106 | (main) |
---|