Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- allocate({[], Allocated}, _Pid) ->
- erlang:display(Allocated),
- {{[], Allocated}, {error, no_frequency}};
- allocate({[Freq|Free], Allocated}, Pid) ->
- erlang:display(Allocated),
- {{Free, [{Freq, Pid}|Allocated]}, {ok, Freq}}.
- deallocate({Free, Allocated}, Freq) ->
- NewAllocated=lists:keydelete(Freq, 1, Allocated),
- {[Freq|Free], NewAllocated}.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement