Created
January 2, 2015 07:43
-
-
Save toopay/7ec64c0d49dca750aca5 to your computer and use it in GitHub Desktop.
Useless worker
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
-module(worker). | |
-export([do_the_useless_job/0]). | |
do_the_useless_job() -> | |
TimeStart = unixtime(), | |
G = fun(X) -> timer:sleep(100), io:format("~p~n", [X]) end, | |
[spawn(fun() -> G(X) end) || X <- lists:seq(1,10)], | |
io:format("All done in ~p microseconds~n", [unixtime()-TimeStart]). | |
unixtime() -> | |
{X,Y,Z} = erlang:now(), | |
(X * 1000000 * 1000000) + (Y * 1000000) + Z. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment