On 19 Sep 2010, at 21:35, Marcel Kilgus wrote:

> gdgqler wrote:
>>> (but remember where the system assumes your likage block lives - directly 
>>> after a common heap header)
>> 
>> This may be obvious - but only after a very large amount of digging into the 
>> software. Unless . . .
>> 
>> Is there somewhere in the manuals that tells us this important 
>> fact about the Thing linkage block?
> 
> From the SMS reference manual: "The linkage block [...] must be
> allocated in the common heap so that SMS.ZTHG, or SMS.RTHG called from
> another program, can de-allocate the linkage block correctly."


I cannot find this quote in my copy of the manual. My manual says "The linkage 
block must be in the common heap so that it may be discarded correctly when the 
Thing is removed." This is on page Section 17 1 dated 18/03/96.

Later, on page Section 17 3, it says "The Thing can be loaded into a suitably 
extended Thing linkage block, in which case no special [removal] code is 
required."

None of this makes it clear to an idiot like me that the linkage block must be 
the first, or only, item in allocated space. It is this positioning which, I 
suppose, helps to solve the problem of a program which owns a linkage block 
being forcibly removed. When a program is removed, all the space used for its 
channels and space allocated to it are returned to the heap. If space used for 
a Thing linkage block is not unlinked first then Things will come to a pretty 
pass. I assume then that the placing of a linkage block's address 12 bytes 
before the start of the block is intended to be a marker in the allocated 
space's header so that general programs which return it to the heap are alerted 
to the fact that this particular item is a Thing linkage block which must be 
unlinked before being thrown away.

Perhaps I am again completely wrong.

However, I am not sure how a general program dealing with a forcibly removed 
program finds space allocated to it. I would assume that there is somewhere a 
linked list of all allocated spaces, each with the ID of its owner. Is this 
true? If so where does the list start?

George
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to