![]() ![]() |
Allocating parameter blocks for slot interrupt handlerDate Written: 12/11/92 Last reviewed: 6/14/93 I need to issue multiple concurrent asynchronous file I/O calls from within my interrupt handler. How should I allocate the parameter blocks for these calls? I can't use the stack, as it isn't persistent beyond my interrupt handler routine. At interrupt time, you can't allocate (or deallocate) parameter blocks with Memory Manager calls. Since you're using the parameter blocks to make asynchronous calls, you can't allocate the parameter block on the stack. So, that means you'll have to preallocate the parameter blocks and put them somewhere where you can grab them at interrupt time. We suggest you allocate a block of parameter blocks large enough to handle a
reasonable number of interrupts and put them in an OS queue owned by your code
(see Inside Macintosh Volume II, chapter 13, for a description of OS
queues, and the To handle the situation where the number of parameter blocks originally put in
the OS queue isn't enough to handle a burst of activity, you can use a driver
(this assumes that you can't just "do nothing" when a parameter block can't be
found). When your interrupt handler can't get a parameter block from the OS
queue (because it's empty), it can drop the request in another OS queue and
continue execution. The driver can use the time it gets during an Downloadables
|
Developer Documentation | Technical Q&As | Development Kits | Sample Code |