Created
May 4, 2012 21:28
-
-
Save Gustav-Simonsson/2597846 to your computer and use it in GitHub Desktop.
Erlang equivalent of http://return1.net/blog/2012/May/3/introduction-to-threads-with-c11
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(foo). | |
-compile(export_all). | |
printer(Text, Num_times, Time_between) -> | |
[begin io:format(Text), timer:sleep(Time_between) end | |
|| _ <- lists:seq(1, Num_times)]. | |
main() -> | |
spawn(?MODULE, printer, ["Hello~n", 30, 10]), | |
spawn(?MODULE, printer, ["World~n", 40, 15]), | |
spawn(?MODULE, printer, ["Parallel World~n", 40, 20]). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment