www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcfoundation/@timer/timer.m

    function obj = timer
%TIMER Object constructor for timer objects
%
%  OBJ = TIMER creates a new timer object.  This uses a java.util.Timer
%  object to schedule single-shot and repeating tasks that call back into
%  Matlab.  Each timer object creates a single new thread.

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.



obj = mbcfoundation.timer;
obj.hJavaTimer = com.mathworks.toolbox.mbc.util.MLTimer(obj);
obj.hDelListener = handle.listener(obj, 'ObjectBeingDestroyed', {@i_killtimer, obj.hJavaTimer});


function i_killtimer(src, evt, hTimer)
hTimer.killTimerQueue;