% waitfortimer - Wait for timer to stop running
%
% waitfortimer :: timer -> action unit.
% waitfortimer :: timer, nonneg ~'time quantum for waiting' -> action unit.
%
% If no wait quantum is supplied, the default is 50ms.

function waittimer(T,dt)

	if nargin<2, dt=0.05; end
	while isvalid(T) && strcmp(T.Running,'on')
		pause(dt);
	end
end
