Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ames!amdcad!amd!intelca!oliveb!amiga!dale From: dale@amiga.UUCP (Dale Luck) Newsgroups: comp.sys.amiga Subject: The dropped Yield() function Message-ID: <1701@amiga.amiga.UUCP> Date: Mon, 10-Aug-87 21:35:24 EDT Article-I.D.: amiga.1701 Posted: Mon Aug 10 21:35:24 1987 Date-Received: Wed, 12-Aug-87 05:31:17 EDT Reply-To: dale@amiga.UUCP (Dale Luck) Organization: Commodore-Amiga Inc., 16795 Lark Ave. Suite 106, Los Gatos CA 95030 Lines: 27 A long time ago, before exec became as elegant as it is now there existed a Yield() function. As signals/semaphores/ports etc became the right way to do things, this function became unnecessary. And it is unnecessary in a perfect world where everybody does the correct Wait() type programming. I however had some cpu intensive demos that just sank the machine when they were all running without this Yield function so for tasks that were running at the same priority in a round robin fashion, i wrote. As long as all the competing tasks used Yield or Waited. Yield() { struct Task *t = FindTask(0); /* Say bye bye */ oldpri = SetTaskPri(t,t->tc_Node.ln_Pri - 1); /* Oh, we are back again, restore priority */ SetTaskPri(t,oldpri); } This has the affect of lowering all competing tasks priority down one notch. The current running task runs at it's normal priority. In the case of a task setting it's own task priority, a reschedule is called and if there are any ready tasks of equal or same priority, then put this one to sleep and start up the first one waiting. Note, the fact that it may start up the next task without waiting for the quantum to expire may actually be me misunderstanding what it is actually doing though. Dale Luck