Created
August 30, 2018 07:43
-
-
Save suncle1993/9de5b6289be78c339928ee8ffefce501 to your computer and use it in GitHub Desktop.
erlang print_server
This file contains hidden or 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
%%%------------------------------------------------------------------- | |
%%% @author Suncle | |
%%% @doc | |
%%% print_server | |
%%% @end | |
%%% Created : 2017/12/18 14:53 | |
%%%------------------------------------------------------------------- | |
-module(print_server). | |
-author("Suncle"). | |
%% API | |
-export([print_server/0, start_print_server/0, send_msg/2]). | |
print_server() -> | |
receive | |
Msg -> | |
io:format("print_server received msg: ~p~n", [Msg]), | |
print_server() | |
end. | |
start_print_server() -> | |
Pid = spawn(?MODULE, print_server, []), | |
Pid. | |
send_msg(Msg, Pid) -> | |
Pid ! Msg, | |
io:format("send_normal_msg: ~p~n", [Msg]). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment