?? outqueue2.m
字號:
%
%Suppose always move the head out of the queue, and when it is moved out,
%we have the last element available(set it to be 0 for the QReady and EndTime for the QDisk)!
%flag 'D'-diskqueue, 'R'-readyqueue
function [Q,Head]=OutQueue2(Q,Qlen,default,flag)
% disp('=========in OutQueue2================');
Head=-1; %Empty Queue or Error
if Q(1,1)~=0
Head=Q(1,1); %Head is only the head process
%---------------------------------
% if flag=='D'
% fprintf('out the p%d from QDisk\n',Head);
% elseif flag=='R'
% fprintf('out the p%d from QReady\n',Head);
% end
else
fprintf('This is a EMPTY Queue(%c), You can not Pick up anything!\n',flag);
return;
end
%-----------------shift the data---------------------
i=1;
while i<Qlen
Q(i,:)=Q(i+1,:);
i=i+1;
end
Q(Qlen,1)=0; %for the P
Q(Qlen,2)=default; % 0 for the QReady, EndTime for QDisk
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -