|
|
| Author |
Message |
< Erlang ~ Begginer, need help with syntax of receive, after |
| gemen1 |
Posted: Fri Jul 16, 2010 9:32 am |
|
|
|
Joined: 16 Jul 2010
Posts: 3
|
Hi, I have currently the following erlang code
Code: -define(tag, normal).
normal(_Self, Data) ->
someUnit_signal:send(?tag, fun(_) -> {?tag, Data} end).
waitfor() ->
{ok, {_, Data}} = someUnit_signal:wait(?tag,
fun({?tag, _}) -> true end,10000), Data.
I want to convert this so that I don't use the class
someUnit_signal, I just want to do a bang between this functions. This is how far I've got
Code: -define(tag, normal).
normal(Self, Data) ->
Self ! {Data}.
waitfor()->
receive
????
after 10000->{timeout}
end.
I am currently lost on what to write in the receive case, I just want the function to wait some time(10000 ms) and send back the Data variable that the function normal receives. So if anybody could fill in this case I would be very greatful
[/code] |
|
|
| Back to top |
|
| zajda |
Posted: Sat Jul 17, 2010 9:06 am |
|
|
|
User
Joined: 22 Aug 2009
Posts: 83
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|