Wolfgang Lenerz wrote:
On 12 Jan 2005 at 23:46, Marcel Kilgus wrote:

Example: allocate the memory before the execution of the job with the
job as the owner. It will get freed automatically on removal of the
job. And how do you know that the memory is not valid anymore? Easy,
the job-ID won't be valid anymore.

Correct. Except that I initially planned to have some kind of linked list. If the memory just goes away because the job is removed the list will be broken.
There are several solutions I not sure yet which one is best.

The solution is very simple. When you allocate memory in QDOS, the header includes a few useful things. One of these is the owning job id (to know what to release when the job is removed or stops). Another is a pointer to a cleanup routine (in syslib I allow this to be set by the user,, very handy).
Anyway, the combination of these two long words can be used to make sure everything is cleaned up properly.


Joachim

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

Reply via email to