Skip to content

Commit

Permalink
Merge pull request ericbmerritt#12 from yrashk/gen_server-example
Browse files Browse the repository at this point in the history
Very simplistic gen_server callback example
  • Loading branch information
ericbmerritt committed Jan 25, 2012
2 parents 8275237 + a155826 commit c2b81eb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/server.jxa
@@ -0,0 +1,26 @@
(module server
(require gen_server))


(defn+ start_link ()
(gen_server/start_link {:local :server} :server [] []))

;; gen_server callbacks

(defn+ init (args)
{:ok {:state}})

(defn+ handle_call (request from state)
{:reply :ok state})

(defn+ handle_cast (msg state)
{:noreply state})

(defn+ handle_info (info state)
{:noreply state})

(defn+ terminate (reason state)
:ok)

(defn+ code_change (old-vsn state extra)
{:ok state})

0 comments on commit c2b81eb

Please sign in to comment.