tonyg@merlin.cvs.rochester.edu (Tony Giaccone) (11/01/89)
Maybe someone out there can give me a hand with this. I'm trying to write some code using the time manager. I want to schedule something to happen on a regular basis, and I need millisecond accuracy. So, I read the relavent sections of inside mac, and I wrote some code that seems like it ought to work. So now the question was "Is it working?". So I set things up so that I could enable, and disable this task. Incremented a global variable ( long integer) in the task. Started it up. Waited several seconds, then stoped it, and examined the contents of the variable using Lightspeed C's debugger (key point here, in order to use the debugger you must be running multifinder). Value of the variable was 9, which didn't seem reasonable at all (several second running, task scheduled every 5 milliseconds, should have gotten a value in the hundreds). Well, it seemed odd that it didn't work, but hey I was trying something new, and things never work the way you expect them to. Finally I decided to simplify my life. I'd use tmon to debugg the thing, and run in finder mode. Sure enough the code works. Great, back to multifinder, 9. So, I place a break point at the start of the task using tmon. Start things up, and each time I get an interrupt, I just hit the exit button, and off we go again. Nine click latter no more interrupts. So, I set a break point in the routine before I restore A5, and look at the variable using tmon. Sure enough it's going like gang busters. Tmon can't keep up with it, and the value is growing by leaps and bounds. So I exit tmon, and am immediatley dumped back in when the next interrupt occurs, and the counter routine has stopped. Now my guess is that the reason the counter has stopped is that by starting it up in the "TMON" context I've somehow associated it with that context, and it stops the first time the interrupt occurs and my applications context is active. However, this doesn't explain why the code doesn't work in the application's context with out TMON. Or why the interrupts stop after about 9 (give or take a few) times through the routine. Can someone give me some insight as to why things are happening like this. I suppose it's not really that big a problem, as I expect to be running this application in the finder environment. However, it would be nice to be able to debug using Lightspeed symbolic debugger. Thanks again for your help, tony giaccone tonyg@cvs.rochester.edu
oster@dewey.soe.berkeley.edu (David Phillip Oster) (11/02/89)
In article <3654@ur-cc.UUCP> tonyg@cvs.rochester.edu (Tony Giaccone) writes: >My counter doesn't count. The assembly code to increment a longInt is one instruction: Addq #1,myVar rts This is 6 bytes (2 for the instruction, 4 for the destination address, 2 for the return.) If your time maanger task is in the system heap, it will run all the time.