[comp.sys.mac.programmer] Interrupt level tasks

mikeoro@hubcap.clemson.edu (Michael K O'Rourke) (07/28/89)

Is there anyway to perform tasks that get move memory at the interrupt
level?  For instance, i need to change some TE records, bring up a 
dialog box, draw some text, etc.  All of which move memory.

The reason i NEED to do it at interrupt level is that the information is
coming in over appletalk via asynch calls and if i don't process it right
away, it may get lost.  I could buffer it to memory, but then i'd have to  
create nodes in something like a linked list and this moves memory also.

Anybody tried anything similiar and have some brilliant insights on the
idea?

I thought of buffering to disk cause file manager calls don't move memory,
but i could end up getting interrupted so often that the buffer file
becomes extremely large and causes other sorts of problems.

Michael O'Rourke

paul@taniwha.UUCP (Paul Campbell) (07/29/89)

In article <6081@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu (Michael K O'Rourke) writes:
>Is there anyway to perform tasks that get move memory at the interrupt
>level?  For instance, i need to change some TE records, bring up a 

	not safely

>The reason i NEED to do it at interrupt level is that the information is
>coming in over appletalk via asynch calls and if i don't process it right
>away, it may get lost.  I could buffer it to memory, but then i'd have to  
>create nodes in something like a linked list and this moves memory also.
>
>Anybody tried anything similiar and have some brilliant insights on the
>idea?

	I did exactly this by making a linked list buffer in memory, you
	have to allocate the memory and put it on a free list when the 
	program starts - you have to disable interrupts when the
	program manipulates the list.


		Paul
-- 
Paul Campbell    UUCP: ..!mtxinu!taniwha!paul     AppleLink: D3213
"Free Market": n. (colloq.) a primitive fertility goddess worshipped by an
obscure cult in the late 20th C. It's chief priest 'Dow Jones' was eventually
lynched by an enraged populace during an economic downturn (early 21st C).

tim@hoptoad.uucp (Tim Maroney) (07/30/89)

In article <6081@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu
(Michael K O'Rourke) writes:
>Is there anyway to perform tasks that get move memory at the interrupt
>level?  For instance, i need to change some TE records, bring up a 
>dialog box, draw some text, etc.  All of which move memory.

Theoretically, yes, but not in practice.  Don't do it....

>The reason i NEED to do it at interrupt level is that the information is
>coming in over appletalk via asynch calls and if i don't process it right
>away, it may get lost.  I could buffer it to memory, but then i'd have to  
>create nodes in something like a linked list and this moves memory also.

No, you just pre-allocate your buffer storage (at the synchronous
level, before starting) and use that.  You don't even need to do your
own locking of interrupts if you use the Enqueue and Dequeue traps to
manipulate the linked lists.  Then at the synchronous level, you pull
entries off the incoming request queue and process them.  After they're
processed, put them back onto the free queue.

You will also have to put in some sort of flow control mechanism if
it's important that the data not be lost.  If you are using ATP, for
instance, don't issue a GetRequest unless there is enough buffer
storage to handle it.  When you do your synchronous processing, you
should note if you are running out of storage, and if so, try to
allocate some more.

>I thought of buffering to disk cause file manager calls don't move memory,
>but i could end up getting interrupted so often that the buffer file
>becomes extremely large and causes other sorts of problems.

It's possible to put your request queu out to disk, but it would wind
up impacting system performance.  If you do flow control, this should
not be necessary.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"The above opinions and suggestions have absolutely nothing to do with
 the little, fat man putting crisp, $100 bills in my pocket."
    -- Alan Vymetalik