Created
April 5, 2017 16:11
-
-
Save paucus/ecc3d6d41a133077cab2ec58dffb8906 to your computer and use it in GitHub Desktop.
testing mailboxes
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
| %%% assignment 1.50 palindrome checker process | |
| -module(b180). | |
| -export([start/0,receiver/0,seqreceiver/0]). | |
| %-include_lib("eunit/include/eunit.hrl"). | |
| -created_by("Marcelo Ruiz Camauër"). | |
| start()-> | |
| Pid = spawn(?MODULE,receiver,[]), | |
| Pid ! {self(),{check,"first"}}, | |
| Pid ! {self(),{check,"second"}}, | |
| Pid ! {self(),{check,"third"}}, | |
| Pid ! stop. | |
| receiver() -> | |
| receive | |
| {From,{check,T}} -> | |
| io:format("Received '~p' from ~w~n",[T,From]), | |
| receiver(); | |
| stop -> true; | |
| _ -> true | |
| end. | |
| seqreceiver() -> | |
| receive | |
| {first, FirstString} -> | |
| io:format("Received: ~w~n", [{first, FirstString}]), | |
| seqreceiver(); | |
| {second, SecondString} -> | |
| receive | |
| {first, FirstString} -> | |
| io:format("Received: ~w~n", [{first, FirstString}]) | |
| end, | |
| io:format("Received: ~w~n", [{second, SecondString}]), | |
| seqreceiver() | |
| end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment