Thread View: comp.sys.amiga.tech
2 messages
2 total messages
Started by Bill Fischer
Wed, 21 Nov 1990 14:53
What's wrong with this picture??
Author: Bill Fischer
Date: Wed, 21 Nov 1990 14:53
Date: Wed, 21 Nov 1990 14:53
51 lines
1794 bytes
1794 bytes
Assuming that program A started up program B by using the standard
technique of:
LoadSeg()
CreateProc() /* prog.foo */
PutMsg()
then program A should be able to 'freeze' program B, to temporarily
suspend it's operation by calling the following fuction:
FreezeProg() {
Disable();
tsk = (struct Task*)FindTask("prog.foo");
Remove(tsk);
tsk->tc_State = tsk->tc_State + 4;
Enable();
return(0);
}
And to 'unfreeze' (or restart) program B by calling the following
function:
MeltProg() {
Disable();
if (tsk->tc_State == 8)
AddTail(&SysBase->TaskReady,tsk);
else
AddTail(&SysBase->TaskWait,tsk);
tsk->tc_State = tsk->tc_State - 4;
Enable();
sig = tsk->tc_SigAlloc & tsk->tc_SigRecvd;
if (sig != 0) Signal(tsk,sig);
return(0);
}
The problem I have is that some programs don't come back to life
when I call MeltProg(). To make it even more complicated, the
programs that won't 'unfreeze', do so intermittently.... In
other words, sometimes they restart OK and sometimes they won't.
I might add that this technique worked pretty well under KS 1.3
but doesn't work AT ALL under 2.0. Am I breaking any rules here??
Under 2.0 I get a software error - task held requestor.
Regards B F
..!hplabs!fritz!wfischer
Re: What's wrong with this picture??
Author: Randell Jesup
Date: Wed, 12 Dec 1990 23:29
Date: Wed, 12 Dec 1990 23:29
36 lines
1854 bytes
1854 bytes
This is an old message, but there have been no responses to it.
In article <154108@felix.UUCP> wfischer@felix.UUCP (Bill Fischer) writes:
>Assuming that program A started up program B by using the standard
>technique of:
>
> LoadSeg()
> CreateProc() /* prog.foo */
> PutMsg()
>
>then program A should be able to 'freeze' program B, to temporarily
>suspend it's operation by calling the following fuction:
[ code that mucks with the exec task lists, etc ]
>And to 'unfreeze' (or restart) program B by calling the following
>function:
[ function that adds task back to an exec list]
Your meltlist call uses AddTail instead of Enqueue. In any case,
mucking with exec task structures like this is _WRONG_. Don't do it.
If you need mutual exclusion, there are plenty of safe ways to implement
it (Forbid() around critical sections, semaphores, etc, etc).
If you're doing this to an external program you don't control,
you should rethink why you want to do this.
Sorry if I seem adamant, but this really is off-limits.
--
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup
Thus spake the Master Ninjei: "If your application does not run correctly,
do not blame the operating system." (From "The Zen of Programming") ;-)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads