Created
October 18, 2012 03:24
-
-
Save oubiwann/3909700 to your computer and use it in GitHub Desktop.
Getting Started with cl-async
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone https://github.com/orthecreedence/cl-async.git | |
$ cd cl-async | |
$ tar cvzf libevent2.tgz ./libevent2 | |
$ start-sbcl | |
* (require 'asdf-install) | |
("ASDF-INSTALL") | |
* (asdf-install:install "libevent2.tgz") | |
Install where? | |
1) System-wide install: | |
System in /usr/lib/sbcl/site-systems/ | |
Files in /usr/lib/sbcl/site/ | |
2) Personal installation: | |
System in /home/oubiwann/.sbcl/systems/ | |
Files in /home/oubiwann/.sbcl/site/ | |
--> 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ start-sbcl | |
* (ql:quickload "cl-async") | |
[snip: lots of output for downloading and installing dependencies] | |
* (sb-ext:save-lisp-and-die "cl-async.core") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ql:quickload "cl-async") | |
;; define a callback for our signal | |
(defun sigint-cb (signal-received) | |
(format t "You interrupted me!~%") | |
(format t "I got signal `~a`~%" signal-received) | |
(as:exit-event-loop)) | |
;; set up a signal handler | |
(defun setup-handler () | |
(as:signal-handler as:+sigint+ #'sigint-cb)) | |
;; start the event loop | |
(as:start-event-loop #'setup-handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sbcl --core cl-async.core --script 03-handle-signal.lisp | |
To load "cl-async": | |
Load 1 ASDF system: | |
cl-async | |
; Loading "cl-async" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^CYou interrupted me! | |
I got signal `2` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment