Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if
- MyReqClock > Req_Clock -> %The requesting lock has higher clock priority
- From ! {ok, Ref, NewClock}, %send an ok message to it!
- % NOT back to open state -> back to WAIT state!!!
- wait(Nodes, Master, Refs, Waiting, MyId, NewClock, MyReqClock); %and enter waiting state
- MyReqClock == Req_Clock -> %The req. clock has the same priority as me -> compare process IDs
- if
- MyId > Req_Id -> %The requesting lock has higher priority
- From ! {ok, Ref, NewClock}, %send an ok message to it!
- wait(Nodes, Master, Refs, Waiting, MyId, NewClock, MyReqClock); %and enter waiting state
- true ->
- wait(Nodes, Master, Refs, [{From, Ref}|Waiting], MyId, NewClock, MyReqClock)
- end;
- true -> %I have higher priority: I keep the request and I go on :p
- wait(Nodes, Master, Refs, [{From, Ref}|Waiting], MyId, NewClock, MyReqClock)
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement