🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #1393

Re: starting a task

#1393
From: Michael Sinz - CATS
Date: Fri, 22 Sep 1989 13:19
69 lines
3353 bytes
In article <6771@dayton.UUCP> joe@dayton.UUCP (Joseph P. Larson) writes:
>
>Okay.  I know I might be able to dig this up before anyone here can get
>to me, but I'm not sure, so....

[ ... lots of description deleted ... ]

>However, how do I implement the call to exit()?  I would prefer that the
>child free all his resources, but the parent can if necessary.  But it is
>much preferred if the child can do it.

If you allocate the memory using the AllocEntry model you get a MemList
structure that you can add to then end of the TC_MEMENTRY list structure
that is in that task structure.  This structure is a list of MemList entries
that is freed when the task/process exits.

I do things as follows:

StartIt:	CALLSYS	Forbit		; We must do this alone...
		lea	ProcName(pc),a0	; The Process name I want...
		move.l	a0,d1		; It needs to be in d1...
		moveq.l	#1,d2		; The priority...
		move.l	#4000,d4	; The stack size...
; Assume the process address has been placed in the correct location
; and the fake SEGLIST is ready to go...
		LINKSYS	CreateProc,a4	; a4 has dos.library
		tst.l	d0		; Check if we started...
		beq.s	NoGo		; If not...  :-(
;
		sub.l	#TC_SIZE,d0	; point back to task
		move.l	d0,a2		; and get into address reg.
;
		lea	TC_MEMENTRY(a2),a0 ; Get list structure pointer...
		move.l	d6,a1		; I had the MemList node in d6...
		CALLSYS	AddTail		; Add my MemList node to the list...
		CALLSYS	Permit		; Let the system go...
		move.l	a2,d0		; Return the task pointer...
		rts
; If we did not get started, we need to dump the memory we allocated...
NoGo:		CALLSYS	Permit
		....			; Dump our memory allocations...
		moveq.l	#0,d0		; Clear the return: No task pointer...
		rts			; Return the NULL to show error
 
>
>So -- anyone have any examples?  I looked at dmouse and launch, but they
>both create processes rather than tasks and use LoadSeg() and all that
>stuff......

This was done in my code without LoadSeg().  You can do the same thing with
Tasks only since you don't have to wait for the task to start you can just
dump all of the MemList entries into the list header that you have initialized
in the TC_MEMENTRY structure of the task structure.  Hope this helps...

>
>-Joe
>-- 
>Life is a cabaret (old chum).
>UUCP: rutgers!dayton!joe   (Picts 1-13 are   DHDSC - Joe Larson/MIS 1060
>ATT : (612) 375-3537       now ready.)       700 on the Mall, Mpls, Mn. 55402


/----------------------------------------------------------------------\
|      /// Michael Sinz -- CATS/Amiga Software Engineer                |
|     ///  PHONE 215-431-9422  UUCP ( uunet | rutgers ) !cbmvax!mks    |
|    ///                                                               |
|\\\///          When people are free to do as they please,            |
| \XX/                they usually imitate each other.                 |
\----------------------------------------------------------------------/
Technical Details
Message-ID: <7971@cbmvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!jtsv16!uunet!cbmvax!mks
References: <6771@dayton.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!jtsv16!uunet!cbmvax!mks
From: mks@cbmvax.UUCP (Michael Sinz - CATS)
Newsgroups: comp.sys.amiga.tech
Subject: Re: starting a task
Message-ID: <7971@cbmvax.UUCP>
Date: 22 Sep 89 13:19:38 GMT
References: <6771@dayton.UUCP>
Reply-To: mks@cbmvax.UUCP (Michael Sinz - CATS)
Distribution: usa
Organization: Commodore Technology, West Chester, PA
Lines: 69