Presentation is loading. Please wait.

Presentation is loading. Please wait.

E177, Rules of Interruptibility of Callbacks March 4, 2008 Copyright 2005-2008, Andy Packard. This work is licensed.

Similar presentations


Presentation on theme: "E177, Rules of Interruptibility of Callbacks March 4, 2008 Copyright 2005-2008, Andy Packard. This work is licensed."— Presentation transcript:

1 E177, Rules of Interruptibility of Callbacks March 4, 2008 http://jagger.me.berkeley.edu/~pack/e177 Copyright 2005-2008, Andy Packard. This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. http://jagger.me.berkeley.edu/~pack/e177 http://creativecommons.org/licenses/by-sa/2.0/

2 Types of Callbacks (generic name for user-triggered event) All graphics objects have definable callbacks for ButtonDownFcn, CreateFcn, DeleteFcn figures additionally have WindowButtonDownFcn WindowButtonMotionFcn WindowButtonUpFcn KeyPressFcn ResizeFcn CloseRequestFcn uicontrol and uimenu Callback (press pushbutton, click radiobutton, select menu item) KeyPressFcn uibuttongroup, uipanel ResizeFcn SelectionChangeFcn ( uibuttongroup only)

3 Interruptibility of Callbacks Suppose callback “A” of object “O” is initiated by a user-action. Callback function fcnA begins executing, “current callback object” is O While fcnA is executing suppose another user-action occurs which generates callback “B” of object “N”. What happens? –Callback B, of object N get placed at the end of the “ fcnA/objO Event Queue”, a list of unprocessed events that ultimately will need attention. This list can have several callback/object pairs. Suppose 3 user-actions have occurred, so the fcnA/objO event queue is fcnA/objO Event Queue: fcnB/objN fcnC/objP fcnD/objQ When does the Event Queue get attention?

4 Event Queue Handling fcnA/objO Event Queue: fcnB/objN fcnC/objP fcnD/objQ –fcnA completes execution fcnA/objO EventQueue gets processed, one event at a time. In this example, fcnB starts executing, with objN as the current callback object –fcnA encounters one of 5 commands drawnow, figure, pause, waitfor, getframe Two situations, depending on Interruptible property of object O ‘off’, then no events get processed. If object N’s BusyAction property is ‘cancel’, then fcnB/objN get removed from fcnA/objO event queue… ‘on’, fcnA gets suspended, and fcnA/objO event queue is processed –Each callback in the queue is executed in the order listed, although… –As (e.g.) fcnB starts executing, a “ fcnB/objN Event Queue” is created, and fcnB ’s execution can be interrupted by any new user-triggered events in the same manner. –When the event Queue is empty, fcnA resumes execution, and new events may be added to its event queue When does this Event Queue get attention? Two cases … Can other Event Queues get created?

5 More on Event Queue during Callbacks Some commands cause the figure to be redrawn. During the execution of a callback, the actual “redraw” event of such a command is also placed in the event queue. Consider fcnA/objO Event Queue with some redraw events fcnA/objO Event Queue Redraw Patch1 fcnB/objN Redraw Pushbutton2 fcnC/objP The details (when the event queue, and each entry, is processed) are as before, except that the Redraw’s always take place, regardless of the Interruptible property of object O


Download ppt "E177, Rules of Interruptibility of Callbacks March 4, 2008 Copyright 2005-2008, Andy Packard. This work is licensed."

Similar presentations


Ads by Google