I've recently implemented pub / sub ( http://redis.io/topics/pubsub )
in my redis class (
https://bitbucket.org/hsarvell/ext/src/default/redis.l?fileviewer=file-view-default
).

Redis is apt get installable in Ubuntu 14.04: sudo apt-get install
redis-server, it will start and just work immediately without further
action.

If you put the whole ext project in /opt/picolisp/ext and run this script:

(load
   "lib.l"
   "ext/base.l"
   "ext/redis.l" )

(de *RedisOnSubRes
   (println (last *RedisSubRes)) )

(setq R (new '(+Redis)))
(connect> R)
(subscribe> R "foo")
#(wait 1)
(println "finished")

with ./pil subscribe.l in /opt/picolisp you will see "finished".

If you uncomment the wait line you will not see "finished", the script
stops on (wait 1) and I have no idea why.

Since I don't pass in a second argument I would assume that wait has
nothing to do with the *Run global in this case and that execution
will simply pause for one millisecond and then continue but this does
not happen.

Extra detail: if you run with the wait line uncommented and start
redis-cli in a different shell followed by the command PUBLISH pl-foo
hello you will see "finished" in the first shell.

So execution continues as soon as we get something back on the socket
we have established.

I don't get why wait literally needs something coming into (in ... )
in order to allow continued execution in this case.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to