/
start.lisp
67 lines (56 loc) · 1.84 KB
/
start.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
(declaim (optimize (debug 3) (safety 3) (speed 0) (space 0) (compilation-speed 0)))
;(declaim (optimize (safety 0) (debug 0) (speed 3) (space 2) (compilation-speed 0)))
(declaim (sb-ext:muffle-conditions style-warning))
(require 'sb-sprof)
(eval-when (:compile-toplevel :load-toplevel :execute)
(sb-ext:restrict-compiler-policy 'debug 3) ; http://stackoverflow.com/questions/4638710/maximum-debug-info-from-steel-bank-common-lisp-slime/4638720#4638720
)
(load "transport")
(load "transport-types")
(load "data/request-opcodes.lisp")
(load "data/request-specs.lisp")
(load "data/reply-specs.lisp")
(load "data/event-specs.lisp")
(load "main")
(load "packages")
(load "zen")
(load "fonts")
(load "input")
(load "debug/info")
(defvar *zenmain-thread* nil)
(defvar *w* nil)
(defvar *init-complete* nil)
(defvar *glx-window-exists* nil)
(defun step1 ()
(setf *main-thread* (bt:make-thread #'main-thread :name 'zen-main-thread))
(setf *transport-thread* (bt:make-thread #'transport-thread :name 'zen-transport-thread)))
(defun step2 ()
(while (not *init-complete*)
)
(setf *zenmain-thread* (bt:make-thread #'main :name 'zenmain-thread))
(while (not *glx-window-exists*)
)
(setf *input-thread* (bt:make-thread #'input-thread :name 'input-thread)))
(defun start ()
(transport-init)
(step1)
(step2))
(defun rst ()
(mapc (compose #'socket-close
#'client-socket)
*clients*)
(setf *clients* nil)
(when (bt:thread-alive-p *transport-thread*)
(bt:destroy-thread *transport-thread*))
(when (bt:thread-alive-p *main-thread*)
(bt:destroy-thread *main-thread*))
(when (bt:thread-alive-p *input-thread*)
(bt:destroy-thread *input-thread*))
(when (bt:thread-alive-p *zenmain-thread*)
(bt:destroy-thread *zenmain-thread*))
(setf *init-complete* nil
*glx-window-exists* nil)
(sleep 1)
;; (reset-server)
(step1)
(step2))