Skip to content

Instantly share code, notes, and snippets.

@oubiwann
Created October 18, 2012 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oubiwann/3909700 to your computer and use it in GitHub Desktop.
Save oubiwann/3909700 to your computer and use it in GitHub Desktop.
Getting Started with cl-async
$ 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
$ start-sbcl
* (ql:quickload "cl-async")
[snip: lots of output for downloading and installing dependencies]
* (sb-ext:save-lisp-and-die "cl-async.core")
(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)
$ sbcl --core cl-async.core --script 03-handle-signal.lisp
To load "cl-async":
Load 1 ASDF system:
cl-async
; Loading "cl-async"
^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