forked from ericbmerritt/joxa
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ericbmerritt#12 from yrashk/gen_server-example
Very simplistic gen_server callback example
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}) |