a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 exec.library
  AVL_AddNode
  AVL_FindFirstNode
  AVL_FindLastNode
  AVL_FindNextNodeByAddress
  AVL_FindNextNodeByKey
  AVL_FindNode
  AVL_FindPrevNodeByAddress
  AVL_FindPrevNodeByKey
  AVL_RemNodeByAddress
  AVL_RemNodeByKey
  AbortIO
  AddDevice
  AddHead
  AddIntServer
  AddLibrary
  AddMemHandler
  AddMemList
  AddPort
  AddResource
  AddSemaphore
  AddTail
  AddTask
  Alert
  AllocAbs
  AllocEntry
  AllocMem
  AllocPooled
  AllocSignal
  AllocTrap
  AllocVec
  Allocate
  AttemptSemaphore
  AttemptSemaphoreShared
  AvailMem
  CacheClearE
  CacheClearU
  CacheControl
  CachePostDMA
  CachePreDMA
  Cause
  CheckIO
  CloseDevice
  CloseLibrary
  ColdReboot
  CopyMem
  CopyMemQuick
  CreateIORequest
  CreateMsgPort
  CreatePool
  Deallocate
  Debug
  DeleteIORequest
  DeleteMsgPort
  DeletePool
  Disable
  DoIO
  Enable
  Enqueue
  FindName
  FindPort
  FindResident
  FindSemaphore
  FindTask
  Forbid
  FreeEntry
  FreeMem
  FreePooled
  FreeSignal
  FreeTrap
  FreeVec
  GetCC
  GetMsg
  InitCode
  InitResident
  InitSemaphore
  InitStruct
  Insert
  MakeFunctions
  MakeLibrary
  ObtainQuickVector
  ObtainSemaphore
  ObtainSemaphoreList
  ObtainSemaphoreShared
  OldOpenLibrary
  OpenDevice
  OpenLibrary
  OpenResource
  Permit
  Procure
  PutMsg
  RawDoFmt
  ReleaseSemaphore
  ReleaseSemaphoreList
  RemDevice
  RemHead
  RemIntServer
  RemLibrary
  RemMemHandler
  RemPort
  RemResource
  RemSemaphore
  RemTail
  RemTask
  Remove
  ReplyMsg
  SendIO
  SetExcept
  SetFunction
  SetIntVector
  SetSR
  SetSignal
  SetTaskPri
  Signal
  StackSwap
  SumKickData
  SumLibrary
  SuperState
  Supervisor
  TypeOfMem
  UserState
  Vacate
  Wait
  WaitIO
  WaitPort
Include
GuruMeditation
Docs » Autodocs » exec.library » AddTask

NAME

	AddTask -- add a task to the system

SYNOPSIS

	AddTask(task, initialPC, finalPC)
A1 A2 A3
APTR AddTask(struct Task *, APTR, APTR);

FUNCTION

	Add a task to the system.  A reschedule will be run; the task with
the highest priority in the system will start to execute (this may
or may not be the new task).
Certain fields of the task control block must be initialized and a
stack allocated prior to calling this function. The absolute
smallest stack that is allowable is something in the range of 100
bytes, but in general the stack size is dependent on what
subsystems are called. In general 256 bytes is sufficient if only
Exec is called, and 4K will do if anything in the system is called.
DO NOT UNDERESTIMATE. If you use a stack sniffing utility,
leave a healthy pad above the minimum value. The system guarantees
that its stack operations will leave the stack longword aligned.
This function will temporarily use space from the new task's stack
for the task's initial set of registers. This space is allocated
starting at the SPREG location specified in the task control block
(not from SPUPPER). This means that a task's stack may contain
static data put there prior to its execution. This is useful for
providing initialized global variables or some tasks may want to
use this space for passing the task its initial arguments.
A task's initial registers are set to zero (except the PC).
The TC_MEMENTRY field of the task structure may be extended by
the user to hold additional MemLists (as returned by AllocEntry()).
These will be automatically be deallocated at RemTask() time.
If the code you have used to start the task has already added
something to the MEMENTRY list, simply use AddHead to add your
new MemLists in. If no initialization has been done, a NewList will
need to be performed.

INPUTS

	task  - pointer to the task control block (TCB).  All unset fields
must be zero.
initialPC - the initial entry point's address
finalPC - the finalization code entry point's address. If zero,
the system will use a general finalizer. This pointer is
placed on the stack as if it were the outermost return
address.

RESULT

	For V36, AddTask returns either a NULL or the address of the new
task. Old code need not check this.

WARNING

	Tasks are a low-level building block, and are unable to call
dos.library, or any system function that might call dos.library.
See the AmigaDOS CreateProc() for information on Processes.

SEE ALSO

RemTask(), FindTask(), amiga.lib/CreateTask(), dos.library/CreateProc(), amiga.lib/NewList()

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Defjam

HZ
PHA
DJ
FLT

Comments:

$VER: d0.se 1.14 Copyright © 2011-2024 Tobias Geijersson support at d0 dot se