Created
June 14, 2011 12:38
-
-
Save seven1240/1024808 to your computer and use it in GitHub Desktop.
fse2
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
-module(fse2). | |
-compile(export_all). | |
start() -> | |
{foo, 'freeswitch@localhost'} ! register_event_handler, | |
receive ok -> {event, 'freeswitch@localhost'} ! {event, all}, loop(0) end. | |
loop(0) -> | |
io:format("start ~p~n", [erlang:localtime()]), | |
loop(1); | |
loop(1000) -> | |
io:format("end ~p~n", [erlang:localtime()]); | |
loop(N) -> | |
receive | |
ok -> loop(N); % ignore this | |
{event, [_UUID|_Headers]} -> | |
{blah, 'freeswitch@localhost'} ! {blah}, % comment this line will be slow | |
loop(N+1); | |
{error, _} -> loop(N); %ignore this | |
M -> io:format("~p~n", [M]), loop(N) | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment